Endpoints
Endpoints available in the API.
Applications
Manage service applications.
GET /applications.php
Give all available applications.
Params
- session (string): Required. Session token.
Success response
{
"status": 0,
"data": [
{
"name": "Forecast"
},
{
"name": "Failures prediction"
}
]
}
Error response
{
"status": 1,
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'GET', 'https://ai.anaimo.com/202111101200/applications.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();
Data
Files used by jobs when training AI models.
GET /data.php
Query content from data files uploaded previously.
- Response type: application/json
Params
- session (string): Required. Session hash.
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
- type (integer): Optional. Type of data being requested. Possible values are:
- 0: When getting stored data.
- 1: When getting data types used for data mapping. It is the default value when no one is set.
- limit (integer): Required when “type” is 0. Max number of records to get. Use 0 for no limit. It is only used when “output” is “0”.
- job_id (integer): Required when “type” is 0. Id of fob for getting data from.
- output (integer): Required when “type” is 0. Use “1” for getting data from job output, or use “0” for getting fob input data.
- progress (integer): Required when “type” is 0. Use “1” for getting only total number of results, or use “0” for get actual results.
- estimate (string): Required when “type” is 0. It contains the name of one attribute from the results, and its usage depends on other attributes:
- when “alter” is not “0”: It is the attribute whose value will be altered according with content of “alter” attribute.
- when “output” is “1” and “insight” is “1” or “2”: It is the name of the attribute, from results, used to sort them in descending order.
- alter (integer): Required when “type” is 0. It is necessary to set “estimate” attribute when using this one. It contains the percentage to be added (positive value) or substracted (negative value) from results in attribute used as “estimate”.
- insight (integer): Required when “type” is 0. Used only when “output” is “1”. You must set “estimate” attribute when using this one. It is processed according with its value.
- when “1”: Results size will be approximately 80% of total records available.
- when “2”: Results size will be 20 records only.
Success response
{
"status": "0",
"data": [
{ "column1": "value", "column2": "value", "columnN": "value" },
{ "column1": "value", "column2": "value", "columnN": "value" },
{ "column1": "value", "column2": "value", "columnN": "value" },
{ "column1": "value", "column2": "value", "columnN": "value" }
]
}
Error response
{
"status": "1",
"data": "[error description]"
}
POST /data.php
Upload a CSV data file to be used by a job training an AI model.
- Request type: multipart/form-data
- Response type: application/json
Remarks
- When using dates, it is necessary to have separate columns for day, month and year.
Params
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
Body
- session (string): Required. Session hash.
- job_id (integer): Required. Job that will use this data.
- animofile (file: text/csv): Required. File containing data. It must be a valid CSV (Comma-Separated Values) file with headers.
Success response
{
"status": "0",
"data": "table populated successfully"
}
Error response
{
"status": "1",
"data": "[error description]"
}
PUT /data.php
Modify previously uploaded data content.
- Request type: application/x-www-form-urlencoded
- Response type: application/json
Params
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
Body
- session (string): Required. Session hash.
- output (integer): Required. Use “0” when columns to be modified are part of job’s input. Use “1” when columns to be modified are part of job’s output data.
- job_id (integer): Id of job whose data will be updated.
- period (string): Required. It must be a valid DateInterval duration string. It is used to modify Date (year, month, day) and Time (hour, minute, second) values from job’s output data to move them ahead in time.
- {column-name} (string): Name of the data column to be modified, add it as many times per columns to modify. Its value can be either “ignore”, for deleting this column, or the type of content used for it. When content type is given, it will be used just as reference.
Success response
{
"status": "0",
"data": "[ID of new record as part of job's outputs]"
}
Error response
{
"status": "1",
"data": "[error description]"
}
Forecasts
Forecasts are AI models trained to perform predictions.
POST /forecasts.php
Create a prediction model.
- Request type: application/x-www-form-urlencoded
- Response type: application/json
Params
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
Body
- session (string): Required. Session hash.
- {column-name} (string): At least one required. Column, with its data, to be added as part of forecast record.
Success response
{
"status": "0",
"data": "success"
}
Error response
{
"status": "1",
"data": "[error description]"
}
Jobs
Jobs are processes running an AI training o execution process.
GET /jobs.php
Query existing Jobs.
- Response type: application/json
Params
- session (string): Required. Session hash.
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
- job_id (integer): Required. ID of job to be queried. Use “0” when getting all jobs.
Success response
{
"status": "0",
"data": [
{ "column1": "value", "column2": "value", "columnN": "value" },
{ "column1": "value", "column2": "value", "columnN": "value" },
{ "column1": "value", "column2": "value", "columnN": "value" },
{ "column1": "value", "column2": "value", "columnN": "value" }
]
}
Error response
{
"status": "1",
"data": "[error description]"
}
POST /jobs.php
Create a job.
- Request type: multipart/form-data
- Response type: application/json
Params
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
Body
- session (string): Required. Session hash.
- training_id (integer): Required. Id of training record where new job will be related to.
- app_name (string): Required. Tag of the application type where this job belongs to. Allowed values are:
- forecast: For jobs related with result predictions.
Success response
{
"status": "0",
"data": "[ID of new Job]"
}
Error response
{
"status": "1",
"data": "[error description]"
}
DELETE /jobs.php
Delete a job.
- Response type: application/json
Params
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
- id (integer): Required. ID of job to delete.
Success response
{
"status": "0",
"data": "success"
}
Error response
{
"status": "1",
"data": "[error description]"
}
POST /job_aborts.php
Abort job processing, it can only be called when job is on Pending or Running status, when job is in any other status it will give an error response.
- Request-type: application/x-www-form-urlencoded
Params
- session (string): Required. Session token.
Body
- job_id (integer): Required. Id of job to abort.
Success response
{
"status": 0,
"data": "success"
}
Error response
{
"status": 1,
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'POST', 'https://ai.anaimo.com/202111101200/job_aborts.php?session={YOUR-SESSION-TOKEN}' );
// put request body.
var requestBody = new FormData();
requestBody.set( 'job_id', 1 );
xhr.send( requestBody );
Sessions
Handle authentication process. It means, login, and logout.
GET /sessions.php
Used to know whether session token is valid.
Params
- session (string): Session token to check.
Success response
{
"status": 0,
"data": "[session token]"
}
Error response
{
"status": "1",
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'GET', 'https://ai.anaimo.com/202111101200/sessions.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();
POST /sessions.php
Authenticate an user for allowing it use other API methods. It must be the first step when using the API when no previous session has been created.
- Request type: multipart/form-data
- Response type: application/json
Body
- email (string): Required. User email.
- password (string): Required. User password.
Success response
{
"status": "0",
"data": [
{
"User_Id": "[session ID]",
"Hash": "[session Hash]"
}
]
}
Error response
{
"status": "1",
"data": "[error description]"
}
DELETE /session.php
Terminate a session (logout).
- Response type: application/json
Params
- user_id (integer): Required. Session user ID.
- session (string): Required. Session Hash.
Success response
{
"status": "0",
"data": "success"
}
Error response
{
"status": "1",
"data": "[error description]"
}
Subscriptions
Subscriptions are those applications, available in Animo AI platform, that user enabled/disabled for use on its account.
GET /subscriptions.php
Give all applications and their relations with user.
Params
- session (string): Required. Session token.
- search (string): Optional. Text used to get only those applications whose name partially matches with it.
- status (string): Optional. Used for filtering subscriptions by their status. Must be “subscribed” or “unsubscribed“.
Success response
{
"status": 0,
"data": [
{
"name": "Forecast",
"status": "subscribed",
"subscription_date": "2020-12-01 17:11:00"
},
{
"name": "Failures prediction",
"status": "unsubscribed",
"subscription_date": "2020-11-15 07:10:11",
"unsubscription_date": "2020-12-01 14:00:30"
},
...
]
}
Error response
{
"status": 1,
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'GET', 'https://ai.anaimo.com/202111101200/subscriptions.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();
POST /subscriptions.php
Subscribe user to an application.
- Request-type: application/x-www-form-urlencoded
Params
- session (string): Required. Session token.
Body
- app (string): Application name, it must be the same value gotten as Application Name from “GET /subscriptions.php”.
Success response
{
"status": 0,
"data": "success"
}
Error response
{
"status": 1,
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'POST', 'https://ai.anaimo.com/202111101200/subscriptions.php?session={YOUR-SESSION-TOKEN}' );
// put request body.
var requestBody = new FormData();
requestBody.set( 'app', 'Forecast' );
xhr.send( requestBody );
DELETE /subscriptions.php
Unsubscribe the user from an application.
Params
- session (string): Required. Session token.
- app (string): Required. Application name, it must be the same value gotten as Application Name from “GET /subscriptions.php”.
Success response
{
"status": 0,
"data": "success"
}
Error response
{
"status": 1,
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'DELETE', 'https://ai.anaimo.com/202111101200/subscriptions.php?session={YOUR-SESSION-TOKEN}&app=Forecast' );
xhr.send();
Summaries
Manage consolidated information about user accounts.
GET /summaries.php
Give user summary data. Generally used to get a general overview about currently authenticated user account.
Params
- session (string): Session token.
Success response
{
"status": 0,
"data": {
"user": {
"name": "John",
"lastname": "Doe",
"email": "john@doe.com"
},
"applications": {
"subscribed": 0,
"unsubscribed": 1
},
"jobs": {
"running": 0
},
"knowledges": 0
}
}
Error response
{
"status": 1,
"data": "[error description]"
}
Request example (Javascript)
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener( 'load', function () {
if ( ( xhr.status >= 200 ) && ( xhr.status < 300 ) ) {
var data = JSON.decode( xhr.response );
if ( 0 == data.status ) {
// TODO: handle success response here.
}
else {
// TODO: handle error response here.
}
}
else {
// TODO: handle HTTP error response here.
}
} );
xhr.addEventListener( 'error', function () {
// TODO: handle communication error here.
} );
xhr.open( 'GET', 'https://ai.anaimo.com/202111101200/summaries.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();
Trainings
Trainings are used to identify, in a human-friendly way, what the AI service learned or is going to learn. For example: “Sales on November 2021”, “Failures for machine HT4 on 2018”, etc.
POST /trainings.php
Create a training.
- Request type: multipart/form-data
- Response type: application/json
Params
- tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
Body
- session (string): Required. Session hash.
- description (string): Required. Text describing, in human-friendly way, what this training will learn after processing data.
Success response
{
"status": "0",
"data": "[Training ID]"
}
Error response
{
"status": "1",
"data": "[error description]"
}