The AI Guardrails API accepts HTTP and HTTPS POST requests. Request parameters are JSON-formatted and sent in the request body. The clientInfo query parameter is passed in the URL query string.
Request structure
All requests use the following structure:
{protocol}://{endpoint}/{resource-path}?{query-string}| Component | Description |
|---|---|
protocol | http or https. Use https for sensitive data. |
endpoint | The AI Guardrails API endpoint. For example, green.cn-shanghai.aliyuncs.com. |
resource-path | The operation path. For example, green/image/scan for synchronous image moderation. |
query-string | Query parameters. Pass the clientInfo parameter here. |
Example: synchronous image moderation request (unencoded)
http://green.cn-shanghai.aliyuncs.com/green/image/scan?clientInfo={"ip":"127.0.0.2","userId":"120234234","userNick":"Mike","userType":"others"}Communication protocols
Both HTTP and HTTPS are supported. Use HTTPS when transmitting sensitive data.
Request parameters
Each request must include two sets of parameters:
| Parameter type | Location | Description |
|---|---|---|
| Common request parameters | URL query string (clientInfo) | Required for all operations. See Common request parameters. |
| Service request parameters | Request body (JSON) | Operation-specific. See the description of each operation. |
Encoding
Requests and responses are encoded in UTF-8.