Prediction APIs (Ranking)
Function
This API is used to perform online prediction.
URI
POST Prediction address returned after the service is successfully deployed
Request
Table 1 describes the request parameters.
Response
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| is_success | Yes | Boolean | Whether the request is successful. The value can be true or false. true indicates the request is successful, and false indicates the request has failed. |
| data | Yes | JSON | Data parameter. For details, see Table 3. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| trace_id | Yes | String | Message tracing ID, which identifies the recommendation result of the current request |
| rec_num | Yes | Integer | Number of returned results |
| user_id | Yes | String | User ID |
| content | Yes | List | Content of recommended items. For details, see Table 4 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| score | Yes | Float | Score of an item. A larger value indicates a higher probability of being recommended. |
| item | Yes | JSON | Recommended item. For details, see Table 5. |
Example
- Example request
{ "rec_num": 50, "user_id": "260086000000100759", "rank_items": ["00860135010002401", "3101010003401"] } - Example of a successful response
{ "is_success": true, "data": { "trace_id": "a94495c062c6443b87c097427d99232d", "user_id": "260086000000100759", "rec_num": 2, "content": [ { "score": 0.524979, "item": { "id": "00860135010002401" } }, { "score": 0.524979, "item": { "id": "3101010003401" } } ] } } - Example of a failed response
{ "is_success": false, "error_msg": "Backend service found error. Failed to respond due to backend service not found or failed to respond, please check the service you request. " }
Status Code
For details about status codes, see Status Codes.
Last Article: Prediction APIs
Next Article: Updating Services
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.