Skip to main content

You are viewing Agora Docs forBetaproducts and features. Switch to Docs

Get rule list

This method gets the list of all banning rules.

Prototype

  • Method: GET
  • Endpoint: https://api.agora.io/dev/v1/kicking-rule
Note

To maximize the success rate of core functions, create (POST), update (PUT), and delete (DELETE), the success rate and accuracy of the query (GET) method is degraded to a certain extent when the quality of the public network is abnormally low. Some request records may be missing in the returned results of the query (GET). When calling POST to create a rule (time is not set to 0), which you need to update or delete later, best practice is to:

  • Save the rule ID returned in the POST request on your server, and rely on this ID for subsequent update and delete operations.
  • To ensure that you can still obtain the rule ID returned in the POST request under poor network connections, set the timeout for the POST request to 20 seconds or higher. Make sure that the timeout is set to no less than 5 seconds.
  • In case the POST request times out or returns a 504 error, use the response of the GET method to obtain the rule ID. If the rule exists, it indicates that the POST request is successful, and you can save the rule ID on your server.

Request parameters

Query parameters

Pass the following query parameters in the request URL:

ParameterTypeRequired/OptionalDescription
appidStringRequiredThe App ID of the project. You can get it through one of the following methods:
  • Copy from the Agora Console.
  • Call the Get all projects API, and read the value of the vendor_key field in the response body.
  • Request header

    The Content-Type field in all HTTP request headers is application/json. All requests and responses are in JSON format. All request URLs and request bodies are case-sensitive.

    The Agora Channel Management RESTful APIs only support HTTPS. Before sending HTTP requests, you must generate a Base64-encoded credential with the Customer ID and Customer Secret provided by Agora, and pass the credential to the Authorization field in the HTTP request header. See RESTful authentication for details.

    Request examples

    Test this request in Postman or use one of the following code examples:

    Sample request:

    curl --request GET \
    --url http://api.sd-rtn.com/dev/v1/kicking-rule \
    --header 'Accept: application/json' \
    --header 'Authorization: '

    Response parameters

    For details about possible response status codes, see Response status codes.

    If the status code is not 200, the request fails. See the message field in the response body for the reason for this failure.

    If the status code is 200, the request succeeds, and the response body includes the following parameters:

    ParameterTypeDescription
    statusStringThe status of this request. success means the request succeeds.
    rulesArrayThe list of banning rules. This array consists of multiple objects. Each object contains the information on one banning rule and includes the following fields:
    • id: Number. The rule ID. If you want to update or delete the rule, you need the rule ID to specify the rule.
    • appid: String. The App ID of the project.
    • uid: Number. The user ID.
    • opid: Number. The operation ID, which can be used to track operation records when troubleshooting.
    • cname: String. The channel name.
    • ip: String. The IP address of the user.
    • ts: String. The UTC time when this rule expires.
    • privileges: Array. User privileges, including the following values:
      • join_channel: String. Bans a user from joining a channel or kicks a user out of a channel.
      • publish_audio: String. Bans a user from publishing audio.
      • publish_video: String. Bans a user from publishing video.
    createAtStringThe UTC time when this rule is created.
    updateAtStringThe UTC time when this rule is updated.

    Response example

    The following is a response example for a successful request:


    _19
    {
    _19
    "status": "success",
    _19
    "rules": [
    _19
    {
    _19
    "id": 1953,
    _19
    "appid": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
    _19
    "uid": 589517928,
    _19
    "opid": 1406,
    _19
    "cname": "11",
    _19
    "ip": "192.168.0.1",
    _19
    "ts": "2018-01-09T07:23:06.000Z",
    _19
    "privileges": [
    _19
    "join_channel"
    _19
    ],
    _19
    "createAt": "2018-01-09T06:23:06.000Z",
    _19
    "updateAt": "2018-01-09T14:23:06.000Z"
    _19
    }
    _19
    ]
    _19
    }

    Interactive Live Streaming