Categorizing your text

After you've acquired your model, you can categorize your text using /v1/models/{id}/tags endpoint.

get
v1/models/{id}/tags

https://api.kimola.com/v1/models/{id}/tags
This endpoint allows you to categorize your text.
Request
Response
Path Parameters
id
required
integer
Id of the model to use in categorization.
Headers
Authorization
required
string
Your API key.
Query Parameters
text
required
string
Text to be categorized.
200: OK
Your text is successfully categorized.
[
{
"name": first_possible_category,
"probability": category_confidence
},
{
"name": second_possible_category,
"probability": category_confidence
}
]
400: Bad Request
There is no API key in the request header.
401: Unauthorized
There is an API key in the request header, but invalid.
403: Forbidden
API key does not have access to the data model.

In Python:

def create_destination(model_id, text):
url = 'https://api.kimola.com/cognitive/v1/models/{0}/tags'.format(model_id)
params = {'text':text}
url_parts = list(urlparse.urlparse(url))
query = dict(urlparse.parse_qsl(url_parts[4]))
query.update(params)
url_parts[4] = urlencode(query)
result = urlparse.urlunparse(url_parts)
return result
text_tags = requests.get(create_destination(model_id_here, text_here)).json()