When to Use the Category Endpoint

Use the /v1/category/ endpoint when:

  • Resources need to be organized into categories.
  • JSON schemas and rules are required to define category structure.

How to Categorize a Resource

Send a POST request to the /v1/category/ endpoint with the required parameters in the body.

Required Parameters

ParameterTypeDescription
resourceStringDescription of the resource to be categorized.
typeStringType of resource (e.g., “file”, “Web”). see full list of accepted types here
json_schemaStringThe JSON schema for defining the category.
json_schema_rulesStringRules to apply to the JSON schema.

Request Example

curl --request POST \
 --url https://api.wetrocloud.com/v1/category/ \
 --header 'Authorization: Token <api-key>' \
 --header 'Content-Type: application/json' \
 --data '{
   "resource": "match review: John Cena vs. The Rock.",
   "type": "text",
   "json_schema": "{'label':'string'}",
   "json_schema_rules": ["never go out of context", "Categorize this data based on their types like football, coding, entertainment, basketball, wrestling, information, etc.", "Always return json", "Always return one word answers"]
 }'

Successful Response

{
    "response": {
        "label": "wrestling"
    },
    "tokens": 1746,
    "success": true
}
FieldDescription
responseJSON object structured as per the provided schema.
tokensThe number of tokens used for processing the request.
successIndicates whether the operation was successful.