Get rule list
https://api.agora.io/dev/v1/kicking-rule
Use this endpoint to get the list of all banning rules.
Request
The request URL and request body is case-sensitive. All requests must use HTTPS.
Request header
Content-Type:application/json- The request header must contain the
Authorizationfield. For details, see RESTful authentication.
Query parameters
QUERY
- appid stringrequired
The 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_keyfield in the response body.
Response
A 200 status code indicates success. The response body contains the following parameters:
OK
- status string
The status of this request.
successmeans the request succeeds. - rules array
The list of banning rules. Each object in the array represents one banning rule and contains the following fields:
Show propertiesHide properties
- id number
The rule ID. Required to update or delete 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
The banned user privileges. Possible values:
join_channel: Bans a user from joining a channel or kicks a user out of a channel.publish_audio: Bans a user from publishing audio.publish_video: Bans a user from publishing video.
- createAt string
The UTC time when this rule was created.
- updateAt string
The UTC time when this rule was last updated.
If the status code is not 200, the request fails. See the message field in the response body for the reason for this failure. Refer to Response status codes for details.
Reference
Best practices for rule management
To maximize the success rate of create, update, and delete operations, query requests are assigned a lower priority. Under poor network conditions, the success rate and accuracy of GET requests may degrade and some request records may be missing from the results.
When you call POST to create a rule where time is not set to 0, use the following best practices to update or delete it later:
- 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 under poor network conditions, 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
504error, use the response of the GET method to obtain the rule ID. If the rule exists, it indicates that the POST request was successful, and you can save the rule ID on your server.