Creating a Model

If you have decided you want to customize your model, you need to create a model first. Creating a model is done by using /v1/models endpoint, explained below.

Your account has a limit for number of models in an account. Please see account details.

post
v1/models

https://api.kimola.com/cognitive/v1/models
Creates a model.
Request
Response
Headers
Authorization
required
string
Your API key.
Body Parameters
language
required
string
Language of the texts that the model will be trained.
name
required
string
Name of the model. Should be unique to the model.
description
optional
string
Description of the model.
200: OK
Model successfully created.
{
"id": integer,
"language": string,
"languageName": string,
"name": string,
"description": string,
"recordCount": integer,
"recordCountStr": string,
"createdDate": string
}
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
There is an API key in the request header, but expired.
409: Conflict
A data model with the same name already exists.
429: Too Many Requests
Account related with the API key has reached the maximum model count.

If you think you've mistaken something while creating the model or think you don't need it anymore you can always delete it. Please see Deleting a Model page for further information.

In Python:

requests.post('https://api.kimola.com/cognitive/v1/models',
headers = {'Authorization': 'APIKey your_api_key_here'},
json = {'language': text_language_here,
'name': model_name_here,
'description': model_description_here})

Helper Endpoints

List Models

You can see the list of models you have created using /v1/models endpoint. This comes in hand when you have to many models to remember, or need to choose a model for categorization.

get
v1/models

https://api.kimola.com/cognitive/v1/models
Lists models you have created.
Request
Response
Headers
Authorization
optional
string
APIKey Your API key.
Query Parameters
pageIndex
optional
integer
Page to show. If not specified shows the first page.
pageSize
optional
integer
Number of models to show per page. If not specified it is 25. Limit is 100.
200: OK
List of models is retrieved.
[
{
"id": integer,
"language": string,
"languageName": string,
"name": string,
"description": string,
"recordCount": integer,
"recordCountStr": string,
"createdDate": string
}
.
.
.
]
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
There is an API key in the request header, but expired.

In Python:

def create_destination(pageIndex, pageSize):
url = 'https://api.kimola.com/cognitive/v1/models'
params = {'pageIndex':pageIndex,'pageSize':pageSize}
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
model_list = requests.get(create_destination(pageIndex_here, pageSize_here)).json()

Retrieve Model Details

You can retrive a model's details by using v1/models/{id} endpoint.

get
v1/models/{id}

https://api.kimola.com/cognitive/v1/models/{id}
Shows details of a model.
Request
Response
Path Parameters
id
required
integer
Document id.
Headers
Authorization
required
string
Your API key.
200: OK
Model is found.
{
"id": integer,
"language": string,
"languageName": string,
"name": string,
"description": string,
"recordCount": integer,
"recordCountStr": string,
"createdDate": string
}
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:

model_details = requests.get('https://api.kimola.com/cognitive/v1/models/{0}'.format(model_no_here)).json()

Please continue to Training a Model page, your model is not ready yet!