Knowledge Base Help Center
< All Topics
Print

Endpoints

Endpoints available in the API.

AIchat

AI Chat (Artificial Intelligence Chat) is the tool that allows users to provide automated chat service to their customers.

POST /aichat

Create an AIchat.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • prompt (string): Required. Prompt is a json text input or a series of words used to initiate an interaction.
  • max_tokens (integer): Optional. Maximum token size. Default ‘4000’.
  • tokens (integer): Optional. Use ‘1’ to return the number of tokens that the prompt occupies, use ‘0’ to not return it. Do not use this parameter if you want the response to the prompt.

Success response

Error response (all the endpoints in this API use this format)

{
  "status": "1",
  "data": "[error description]"
}

App

Apps are AI models trained to perform predictions.

GET /app

Get an app elements.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • app_id (string): Required. Name of the app you want to access.
  • fields (string): Required. Name of columns to get on the query.
  • type (integer): Required. Select type of GET. Default ‘0’.
    • 0: Get apps.
    • 1: Get app by id or job_id.
    • 2: Get parameters.
  • filters (string): Required if type ‘0’ or type ‘2’. Parameters to perform the WHERE condition.
  • id (integer): Required if type ‘1’. The id of the recorde you want to get.
  • job_id (integer): Required if type ‘1’. The id of the job you want to get.

Success response

{
  "status": "0",
  "data": [
    {
      "Job_Id":"1",
      "Training_Id":"1",
      "LayersRequested":"3",
      "LearningRate":"0.5",
      "RequestType":"0",
      "DataRowsToConsider":"1",
      "NoNegatives":"0",
      "IncreaseMargin":"0",
      "DecreaseMargin":"0",
      "DeviationTarget":"0.80",
      "DeviatedTarget":"0.80"
    },
    ...
  ]
}

POST /app

Create a prediction model.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Params

Body

  • session (string): Required. Session hash.
  • app_id (string): Required. Name of the app you want to create.
  • simple (integer): Required. Indicates if you just want to create a record. Default ‘0’.
  • fields (string): Required if simple ‘1’. Column, with its data, to be added as part of app record.
  • params (string): Required if simple ‘1’. Values for each parameter of fields.

Success response

{
  "status": "0",
  "data": "[ID of new App]"
}

PUT /app

Update a prediction model.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • app_name (string): Required. Name of the app.
  • id (integer): Required. Id of app to update. Default ‘0’.
  • job_id (integer): Required. Id of job to use. Default ‘0’.
  • training_id (integer): Required. Id of training to use. Default ‘0’.
  • status (integer): Required. Status of our app. Default ‘0’.
  • request_type (integer): Required. Number between 0 and 2. Type of request needed.
  • neurons (integer): Required if request_type ‘1’. Number of neurons using. Default ‘0’.
  • inputs (integer): Required if request_type ‘1’. Number of inputs. Default ‘0’.
  • outputs (integer): Required if request_type ‘1’. Number of outputs. Default ‘0’.
  • layers_created (integer): Required if request_type ‘1’. Number of layers created. Default ‘0’.
  • layers_requested (integer): Required if request_type ‘1’. Number of layers requested. Default ‘0’.
  • host (string): Required. Name of host that is used for the query.
  • pid (integer): Required. PID of app top update. Default ‘0’.

Success response

{
  "status": "0",
  "data": "success"
}

PATCH /app

Change the probability field.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • app_id (string): Required. Name of the app yo want to access.
  • id (integer): Required. The id of the recorde you want to get.
  • probability (float): Required. A number between 0 and 1.

Success response

{
  "status": "0",
  "data": "success"
}

Applications

Manage service applications.

GET /applications

Lists all available applications.

Params

  • session (string): Required. Session hash.

Success response

{
  "status": 0,
  "data": [
    {
      "name": "Forecast",
      "planId": "planId"
    },
    {
      "name": "Failures prediction",
      "planId": "planId"
    },
    ...
  ]
}

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/api/202203010900/applications.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();

Chat

Chat is where the conversations that have been had with the Anaimo chat platform are stored.

GET /chat

Get a chat elements.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • user_id (integer): Optional. Session user ID.
  • hash (string): Optional. Alphanumeric hash of the chat.
  • upd_date (string): Optional. Date from where you want to check changes.
  • chat_id (string): Optional. Session chat ID.
  • fields (string): Optional. Fields from the table you want to get.
  • where (string): Optional. Where clausure you want to use on the query.

Success response

{
  "status": 0,
  "data": [
    {
      "Id":"1",
      "usca_Id":"3",
      "StartDateTime":"2023-06-13 14:18:47",
      "FinishDateTime":null,
      "Status":"3",
      "ControlType":"0",
      "UserManaging_Id":"2",
      "Tokens":"0",
      "Hash":null
    },
    {
      "Id":"2",
      "usca_Id":"14",
      "StartDateTime":"2023-06-13 15:52:07",
      "FinishDateTime":null,
      "Status":"3",
      "ControlType":"1",
      "UserManaging_Id":"3",
      "Tokens":"0",
      "Hash":null
    },
    ...
  ]
}

POST /chat

Create a chat.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • usca_id (integer): Required. Session use case ID.
  • user_id (integer): Required. Session user ID.
  • hash (string): Optional. Alphanumeric hash of the chat.

Success response

{
  "status": "0",
  "data": "[ID of new Chat]"
}

PATCH /chat

Modify only provided chat.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • id (integer): Required. Session chat ID.
  • finish (integer): Optional. Post ‘1’ for finished chat. Default ‘0’.
  • status (string): Optional. Status code to get only chats matching it.
  • control (string): Optional. Controltype of the chat.
  • user (string): Optional. Session user ID.
  • tokens (integer): Optional. Tokens of the sentence. Default ‘0’.
  • active(integer): Optional. Used for setting the activity of the chat to 0. Default ‘1’.

Success response


Chat Sentence

Manage sentence related with chats.

PATCH /chat-sentence

Change the rate field.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • chat_id (string): Required. Session chat ID.
  • sent_id (string): Required. Session chat sentence ID.
  • rate (string): Required. Use ‘0’ to rate bad the sentence, use ‘1’ to rate good the sentence.

Success response

{
  "status": "0",
  "data": "success"
}

Client

Client are users or individuals who are direct customers of Anaimo.

GET /client

Query existing clients.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • fields (string): Optional. Fields from the table you want to get.
  • where (string): Optional. Where clausure you want to use on the query.

Success response

{
  "status":"0",
  "data":[
    {
      "Id":"1",
      "FiscalId":"(NULL)",
      "CompanyName":null,
      "CompanyLegalName":null,
      "CompanyAddress1":null,
      "CompanyAddress2":null,
      "CompanyAddress3":null,
      "CompanyCity":null,
      "CompanyZipCode":null,
      "CompanyOpenAIKey": "[open_ai_key]"
    },
    ...
  ]
}

POST /client

Create a client.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • open_ai_key (string): Required. This key is used to authenticate and authorize access to OpenAI’s services.

Success response

{
  "status": "0",
  "data": "[ID of new Client]"
}

Consumptions

User resource consumptions due to applications usage and data storage.

GET /consumptions

Query user consumptions.

  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • search (string): Optional. Free-text criteria used for search consumptions.
  • invoiced (integer): Optional. Use ‘1’ to get only consumptions already invoiced, use ‘0’ to get only non-invoiced consumptions. Do not use this parameter if you want all consumptions.
  • date_from (string): Optional. Date used to get consumptions starting from it. Format must be “Y-m-d H:i:s”.
  • date_to (string): Optional. Date used to get consumptions ending to it. Format must be “Y-m-d H:i:s”.
  • app (string): Optional. Name of the application to filter consumptions for.

Success response

{
  "status": "0",
  "data": [
    {
      "user_id": 5,
      "user_name": "John Doe",
      "date": "2022-01-25 17:10:49",
      "app_name": "Forecast",
      "training_id": 4,
      "host": "demo-234567-services.anaimo.com",
      "pid": 1374,
      "ram": 1758.97,
      "cpu": 27.6834,
      "disk": 3307.75,
      "date_invoiced": null
    },
    {
      "user_id": 6,
      "user_name": "Johna Doe",
      "date": "2022-01-25 17:10:49",
      "app_name": "Forecast",
      "training_id": 4,
      "host": "demo-234568-services.anaimo.com",
      "pid": 14266,
      "ram": 1256.95,
      "cpu": 44.6871,
      "disk": 1610.23,
      "date_invoiced": "2022-01-25 17:10:49"
    }
  ]
}

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/api/202203010900/consumptions.php?session={YOUR-SESSION-TOKEN}&search=app-name&invoiced=1&date_from=2022-01-01 00:00:00&date_to=2022-01-31 23:59:59');
xhr.send();

Data

Files used by jobs when training AI models.

GET /data

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: Get stored data. It is the default value when no one is set.
    • 1: Get data types used for data mapping.
  • job_id (integer): Required if type ‘0’. Id of job for getting data from.
  • output (integer): Required if type ‘0’. Use ‘1’ for getting data from job output, use ‘0’ for getting job input data. Default ‘0’.
  • progress (integer): Required if type ‘0’. Use ‘1’ for getting only total number of results, use ‘0’ for get actual results. Default ‘0’.
  • limit (integer): Required if type ‘0’. Used only if output ‘0’. Max number of records to get. Use “0” for no limit. Default ‘0’.
  • insight (integer): Required if type ‘0’. Used only if output ‘1’. You must set “estimate” attribute when using this one. It is processed according with its value.
    • 1: Results size will be approximately 80% of total records available.
    • 2: Results size will be 20 records only.
  • alter (integer): Required if type ‘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”.
  • estimate (string): Required if type ‘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.

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" }
  ]
}

POST /data

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.
  • session (string): Required. Session hash.
  • job_id (integer): Required. Job that will use this data.
  • file (integer): Required. Number of files. Default ‘1’.
  • Anaimofile (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"
}

PUT /data

Modify previously uploaded data content.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

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): Required . 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.

Success response

{
  "status": "0",
  "data": "[ID of new record as part of job's outputs]"
}

Job Aborts

Manage aborts of jobs.

POST /job_aborts

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"
}

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/api/202203010900/job_aborts.php?session={YOUR-SESSION-TOKEN}' );

// put request body.
var requestBody = new FormData();
requestBody.set( 'job_id', 1 );

xhr.send( requestBody );

Job Data

Manage user data related with jobs.

DELETE /job_data

Delete user-related data from a job. It does not delete the job, only its data.

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.

Body

  • job_id (integer): Required. Id of job to delete user-related data from.

Success response

{
  "status": 0,
  "data": "success"
}

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/api/202203010900​/job_data.php?session={YOUR-SESSION-TOKEN}&tz=Europe/Madrid&job_id=1' );
xhr.send();

Jobs

Jobs are processes running an AI training o execution process.

GET /jobs

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.
  • status (integer): Optional. Current status of the app. Default ‘0’.
  • search (string): Optional. Free-text criteria used for search jobs user-related.
  • status_filter (integer): Optional. Status codes to get only jobs matching them. It can contains multiple codes separated by comma (,).
  • date_from (string): Optional. Date used to get jobs whose status start from it. Format must be “Y-m-d H:i:s”.
  • date_to (string): Optional. Date used to get jobs whose status ends to it. Format must be “Y-m-d H:i:s”.
  • app_name (string): Optional. Application name to get only jobs related to it.

Success response

{
  "status":0,
  "data":[
    {
      "Id":"1",
      "Session_Id":"1",
      "Training_Id":"1",
      "app_name":"",
      "Status":"0",
      "DateTime":"2023-05-25 23:00:00",
      "User_Name":null,
      "Nets":"0"
    },
    {
      "Id":"2",
      "Session_Id":"2",
      "Training_Id":"6",
      "app_name":"forecast",
      "Status":"1",
      "DateTime":"2023-08-23 13:38:01",
      "User_Name":"pepe",
      "Nets":"0"
    },
    ...
  ]
}

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/api/202203010900​/jobs.php?session={YOUR-SESSION-TOKEN}&tz=Europe/Madrid&search=app-name&status_filter=1&date_from=2022-01-01 00:00:00&date_to=2022-01-31 23:59:59' );
xhr.send();

POST /jobs

Create a job.

  • Request type: multipart/form-data
  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • app_name (string): Required. Tag of the application type where this job belongs to.
  • newTraining (string): Optional. Post ‘1’ for request new trainings.

Success response when newTraining is not set

{
  "status": "0",
  "data": 
    {
      "job_id": "[ID of new Job]",
      "training_id": 1
    }
}

Success response when newTraining = 1

{
  "status": "0",
  "data": 
    {
      "job_id": "[ID of new Job]",
      "training_id": "[ID of new Training]"
    }
}

DELETE /jobs

Delete a job.

  • 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 delete.

Success response

{
  "status": "0",
  "data": "success"
}

PUT /jobs

Update a job.

  • Request type: multipart/form-data
  • Response type: application/json

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • training_id (integer): Required. Id of training record where new job will be related to.
  • job_id (string): Required. Id of the job to update.
  • app_name (string): Required. Tag of the application.
  • status (integer): Required. Current status of the app. Default ‘0’.

Success response

{
"status": "0",
"data": "[ID of new Job]"
}

Jobs Progress

Manage progress of jobs.

GET /jobs_progress

Give jobs progress.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • job_id (string): Optional. Id of the job to get the progress.
  • progress (integer): Optional. Use ‘1’ for get actual results, use ‘2’ for getting a stat record. Default ‘0’.
  • reqType (integer): Optional. Specify if you want to consider all the jobs progress of the app. Default ‘0’.
  • app_name (string): Optional. Tag of the application.

Success response

{
  "status":"0",
  "data":{"Advance":0}
}

Logs

Records used to annotate events occurred during processes execution.

GET /logs

List all log entries. It is available only for admin users.

  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • host (string): Optional. Host to look for related log entries.
  • procedure (string): Optional. Procedure where records must be related to.
  • date_from (string): Optional. Date used to get entries from this one. Format must be “Y-m-d H:i:s”.
  • date_to (string): Optional. Date used to get entries until this one. Format must be “Y-m-d H:i:s”.
  • pid (integer): Optional. Process PID.
  • type (integer): Optional. Type of log entries to get. Allowed values are:
    • 4: Error
    • 3: Warning
    • 2: Normal
    • 1: Verbose
    • 0: Extra verbose
  • search (string): Optional. Free-text criteria used for search logs.
  • limit (integer): Optional. Max number of logs to get.

Success response

{
  "status": "0",
  "data": [
    {
      "id": 1,
      "host": "HFTP_5636",
      "pid": 4578,
      "procedure": "proc-lt10",
      "type": 1,
      "date": "2022-01-01 14:15:16",
      "text": "log entry"
    }
  ]

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/api/202203010900​/logs.php?session={YOUR-SESSION-TOKEN}&type=1&date_from=2022-01-01 00:00:00&date_to=2022-01-31 23:59:59' );
xhr.send();

POST /logs

Allow user to create a log register.

  • Response type: appplication/json

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • message (string): Required. The log message that you want to record (or procedure).
  • PID (integer): Required. PID of the requesting function.
  • host (string): Optional. Name of the caller application.
  • log_type (integer): Optional. Id of the log type.
  • caller (string): Optional. The name of the caller application.

Success response

{
  "status": 0,
  "data": "[ID of new Log]"
}

Request example

https://ai.anaimo.com/api/202203010900/logs.php?session=6488095b3b418&tz=Europe/Madrid&log_type=1&caller=caller1&PID=1&message=hola mundo

Network Weights

Network weights used by training AI models.

GET /netw

Query a network weight.

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • training_id (integer): Required. Id of training to load.

Success response

{
  "status": 0,
  "data": "sucess"
}

POST /netw

Create a network weight.

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • query (string): Required. SQL query content to create.

Success response

{
  "status": 0,
  "data": "[ID of new Network Weight]"
}

DELETE /netw

Delete network weights.

Body

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • training_id (integer): Required. Id of training to use.

Success response


Passwords

Allow change user password or start the password recovery process in case it was lost or forgotten.

POST /passwords

Start password recovery process. When success, user will receive an email for validation and to continue with the process.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Body

  • email (string): Required. Email address of user who wants to start the password recovering process.

Success response

{
  "status": 0,
  "data": "success"
}

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', '/passwords.php' );

// put request body.
var requestBody = new FormData();
requestBody.set( 'email', 'test@mail.local' );

xhr.send( requestBody );

PUT /passwords

Change user password. It is used either from an authenticated user or from a guest using a password recovery code.

User will receive a password changed notification email if process was success.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Params

  • session (string): Optional. Session token. Must be supplied when and authenticated user is changing its password.

Body

  • token (string): Required only for non-authenticated users. Token gotten from password recovery process.
  • current_password (string): Required only for authenticated users. Current user password.
  • new_password (string): Required. New password.
  • new_password_repeat (string): Required. New password again, it is used to validate that it was written without errors.

Success response

{
  "status": 0,
  "data": "success"
}

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( 'PUT', '/passwords.php' );

// put request body.
var requestData = [
  'new_password=123456',
  'new_password_repeat=123456',
  'token=abc123'
].join( '&' );

xhr.send( requestData );

Sentence

A sentence is a group of words that conveys a specific idea, question, or statement in a chat.

GET /sentence

Get a sentence elements.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • chat_id (integer): Required. Session chat ID.
  • usca_id (integer): Required when “chat_id” is empty. Session use case ID.
  • fields (string): Required when “usca_id” and “chat_id” are empty. Fields from the table you want to get.
  • where (string): Required when “usca_id” and “chat_id” are empty. Where clausure you want to use on the query.

Success response

{
  "status":"0",
  "data":[
    {
      "Id":"1",
      "Text":"[Sentence content]"
    },
    ...
  ]
}

POST /sentence

Create a sentence.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • text (string): Required. Sentence content.
  • chat_id (integer): Optional. Session chat ID.
  • usca_id (integer): Optional. Used if chat_id is not set. Session use case ID.
  • user_id (integer): Optional. Used if chat_id is set. Session user ID.
  • role (integer): Optional. Used if chat_id is set. Role to filter user for. Default ‘0’.
    • 0: System.
    • 1: User.
    • 2: Assistant.
  • rate (integer): Optional. Used if chat_id is set. session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • chat_id (string): Required. Session chat ID.
  • sent_id (string): Required. Session chat sentence ID.
  • rate (string): Required. Use ‘0’ to rate bad the sentence, use ‘1’ to rate good the sentence. Default ‘1’.
  • tokens (integer): Optional. Used if usca_id is set. Tokens of the sentence. Default ‘0’.

Success response

{
  "status": "0",
  "data": "[ID of new Sentence]"
}

PATCH /sentence

Modify content of provided sentence.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • id (integer): Required. Session sentence ID.
  • new_text (string): Required. Text to update.

Success response

{
  "status": "0",
  "data": "success"
}

Sessions

Handle authentication process. It means, login, and logout.

GET /sessions

Used to know whether session token is valid.

Params

  • session (string): Required. Session token to check.

Success response

{
  "status": 0,
  "data": {
    "hash": "[session-hash]",
    "user": {
      "role": "[user-role]",
      "name": "[user-name]"
    }
  }
}

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/api/202203010900/sessions.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();

POST /sessions

Authenticate an user for allowing it use other API methods with the credential of Amazon. 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_Role": "[user role]",
      "Name": "[user name]",
      "Client_Id": "[client ID]"
    }
  ]
}

DELETE /session

Terminate a session (logout).

  • Response type: application/json

Body

  • session (string): Required. Session hash.
  • user_id (integer): Required. Session user ID.

Success response

{
  "status": "0",
  "data": "success"
}

Status

Status is the table where you can manage a job status.

GET /stat

Get a status record.

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • terminate (integer): Optional. Specify if you want to get a terminated status.
  • job_id (integer): Required if terminate ‘0’. The id of the asociated job.
  • progress_type (integer): Required if terminate ‘0’. Use ‘1’ for getting only total number of results, use ‘2’ for get actual results. Default ‘2’.
  • pid (integer): Required if terminate not ‘0’. PID of app to get.
  • host (string): Required if terminate not ‘0’. Name of host that is used for the query.
  • name (string): Required if terminate not ‘0’. The name to identify the status.
  • status (string): Required if terminate not ‘0’. Status codes to get only jobs matching them. It can contains multiple codes separated by comma (,).

Sucess response

{"status":"0","data":[]}

POST /stat

Create a status record.

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • name (string): Required. The name to identify the status.
  • host (string): Required. Name of host that is used for the new status record.
  • pid (integer): Required. PID of app to create.
  • parameters (string): Required. List of parameters for the app.
  • caller (string): Optional. The name of the caller app.
  • text (string): Optional. A text field to write some information.
  • job_id(integer): Optional. The id of the asociated job.

Sucess response

{
  "status":"0",
  "data": "[ID of new status record]"
}

PATCH /stat

Terminate or modify one status.

Body

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • name (string): Required. The name to identify the status.
  • host (string): Required. Name of host that is used for the status record.
  • pid (integer): Required. PID of app to modify.
  • terminate (integer): Required. Specify if you want to terminate the status or modify it.
  • procedure (string): Optional. Used if terminate ‘0’. The name of the caller app.
  • text (string): Optional. Used if terminate ‘0’. A text field to write some information.
  • advance (float): Optional. Used if terminate ‘0’. Specify the advance of the job.

Success response

{
  "status":"0",
  "data": "success"
}

Subscriptions

Subscriptions are those applications, available in Animo AI platform, that user enabled/disabled for use on its account.

GET /subscriptions

Lists all applications and their relations with users.

When current user is an administrator, all user subscriptions will be delivered.

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • 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",
      "user": {
        "id": 1,
        "name": "John Doe"
      }
    },
    {
      "name": "Failures prediction",
      "status": "unsubscribed",
      "subscription_date": "2020-11-15 07:10:11",
      "unsubscription_date": "2020-12-01 14:00:30",
      "user": {
        "id": 1,
        "name": "John Doe"
      }
    },
    ...
  ]
}

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

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": "[ID of new subscribe user]"
}

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

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”.
  • user (integer): Required when user making the request is an administrator. Id of user to unsubscribe from application.

Success response

{
  "status": 0,
  "data": "success"
}

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/api/202203010900/susbscriptions.php?session={YOUR-SESSION-TOKEN}&app=Forecast');

xhr.send();

PATCH /subscriptions

Modify the subscription related with the provided app.

Params

  • session (string): Required. Session token.
  • params (string): Required. List of params to update.
  • user (integer): Required when user making the request is an administrator. Id of user to unsubscribe from application.

Success response

{
  "status": 0,
  "data": "subscription_id"
}

Summaries

Manage consolidated information about user accounts.

GET /summaries

Give user summary data. Generally used to get a general overview about currently authenticated user account.

Params

  • session (string): Required. Session token.

Remarks

Response varies according to user who make the request. Possible cases are:

  • When you are an administrator, response will not contain “applications” property.
  • When you are NOT an administrator, response will not contain “users” property.

Success response

{
  "status": 0,
  "data": {
    "user": {
      "name": "John",
      "lastname": "Doe",
      "email": "john@doe.com"
    },
    "applications": {
      "subscribed": 0,
      "unsubscribed": 1
    },
    "jobs": {
      "running": 0
    },
    "knowledges": 0,
    "users": {
      "enabled": 0,
      "disabled": 0
    }
  }
}

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/api/202203010900/summaries.php?session={YOUR-SESSION-TOKEN}' );
xhr.send();

Training Data

Manage user data related with trainings.

DELETE /training_data

Delete user-related data from a training. It does not delete the training nor its jobs, only data related to it.

Params

  • session (string): Required. Session token.
  • training_id (integer): Required. Id of training to delete user-related data from.

Success response

{
  "status": 0,
  "data": "success"
}

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/api/202203010900​/training_data.php?session={YOUR-SESSION-TOKEN}&training_id=1' );
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.

GET /trainings

Query existing trainings.

  • Response type: application/json

Params

  • session (string): Required. Session token.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • mode (integer): Optional. Use “1” for new working mode. Omit it to use legacy working mode.
  • job_id (integer): Required when “id” is empty. Used on legacy working mode. Id of job for querying related trainings.
  • id (integer): Required when “job_id” is empty. Used on legacy working mode. Id of training to get data from.
  • app_name (string): Required when “id” is empty. Used on legacy working mode. Name of the app.
  • status (integer): Optional. Used on new working mode. Status code to get only trainings matching it.
  • date_from (string): Optional. Used on new working mode. Date used to get trainings whose status start from it. Format must be “Y-m-d H:i:s”.
  • date_to (string): Optional. Used on new working mode. Date used to get trainings whose status ends to it. Format must be “Y-m-d H:i:s”.
  • search (string): Optional. Used on new working mode. Free-text criteria used for search trainings.
  • limit (integer): Optional. Max number of trainings to get.
  • sort (string): Optional. Used on new working mode. Sorting direction (“asc” or “desc”).

Legacy success response

{
  "status": 0,
  "data": [
    {
      "Neurons": 300,
      "Inputs": 800,
      "Outputs": 1,
      "LayersRequested": 3,
      "LayersCreated": 3
    },
    ...
  ]
}

Success response when mode = 1

{
  "status": 0,
  "data": [
    {
      "id": 1,
      "app_name": "Forecast",
      "description": "Sales QI-2020",
      "status": 2,
      "date": "2022-01-01 17:53:16",
      "neurons": 300,
      "inputs": 800,
      "outputs": 1,
      "layers_requested": 3,
      "layers_created": 3
    },
    ...
  ]
}

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/api/202203010900​/trainings.php?session={YOUR-SESSION-TOKEN}&tz=Europe/Madrid&mode=1' );
xhr.send();

POST /trainings

Create a training.

  • Request type: multipart/form-data
  • Response type: application/json

Params

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": "[ID of new Training]"
}

PUT /trainings

Update a training.

  • Request type: multipart/form-data
  • Response type: application/json

Params

Body

  • session (string): Required. Session hash.
  • update (integer): Required. Use ‘0’ to update description, else update all. Default ‘0’.
  • id (integer): Required if update ‘0’. Id of training to update. Default ‘0’.
  • description (string): Required if update ‘0’. Text describing, in human-friendly way, what this training will learn after processing data.
  • app_name (string): Required if update not ‘0’. Name of the app.
  • id (integer): Required if update not ‘0’. Id of app to update. Default ‘0’.
  • neurons (integer): Required if update not ‘0’. Number of neurons using. Default ‘0’.
  • inputs (integer): Required if update not ‘0’. Number of inputs. Default ‘0’.
  • outputs (integer): Required if update not ‘0’. Number of outputs. Default ‘0’.
  • layers_requested (integer): Required if update not ‘0’. Number of layers created. Default ‘0’.
  • layers_created (integer): Required if update not ‘0’. Number of layers requested. Default ‘0’.
  • success_rate (integer): Required if update not ‘0’. Number of success rate. Default ‘0’.

Success response

{
  "status": "0",
  "data": "success"
}

PATCH /trainings

Modify a training.

  • Request type: multipart/form-data
  • Response type: application/json

Params

Body

  • session (string): Required. Session hash.
  • status (integer): Required. Status of training. Default ‘0’.
  • id (integer): Required. Id of training to update. Default ‘0’.

Success response

{
  "status": "0",
  "data": "success"
}

Use case

Use case represents a specific scenario of how a user interacts with the system to achieve a particular goal.

GET /usecase

Get a use case elements.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • user_id (integer): Required. Session user ID.
  • upd_date (string): Required. Date from where you want to check changes.
  • clie_id (string): Required when “user_id” and “upd_date” are empty. Session client ID.
  • fields (string): Required when “user_id” and “clie_id” are empty. Fields from the table you want to get.
  • where (string): Required when “user_id” and “clie_id” are empty. Where clausure you want to use on the query.

Success response

{
  "status":"0",
  "data":[
    {
      "Id":"1",
      "Description":"Chatbot of Manolo Restaurant",
      "Welcome":"Hi, I am a chatbot. What can i help you",
      "StartDateTime":"2023-08-23 10:54:47",
      "FinishDateTime":null,
      "Tokens":"0",
      "WordsForManual":null,
      "WordsForAttention":null,
      "TimeOutForAutoMsg":"100",
      "AutoMsg":null,
      "ManualMessage":null,
      "LastUpdDateTime":"2023-08-23 10:54:47",
      "Hash":"[hash]",
      "Temperature":"0"
    },
    ...
  ]
}

POST /usecase

Create a use case.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • client_id (integer): Required. Session client ID.
  • data (string): Required. Data is a json string where the desired fields are introduced. Ex: {“Description”:”Some description”,”TimeOutForAutoMsg”:100}

Success response

{
  "status": 0,
  "data": "[ID of new Use Case]"
}

PATCH /usecase

Modify only provided use case.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • id (integer): Required. Session use case ID.
  • data (string): Required. Data is a json string where the desired fields are introduced. Ex: {“Description”:”Chatbot of Manolo Restaurant”}
  • close (integer): Optional. Value that indicates if the usecase should be closed.
  • open (integer): Optional. Value that indicates if the usecase should be opened.
  • active (integer): Optional. Used for setting the activity of the chat to 0. Default ‘1’.

Success response

{
  "status": 0,
  "data": "success"
}

Use Case Sentence

Manage sentence related with use cases.

POST /usecase_sentence

Create an use case related sentence.

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • usca_id (string): Required. Session use case ID. It can contains multiple IDs separated by comma (,).
  • sent_id (string): Required. Session sentence ID. It can contains multiple IDs separated by comma (,).
  • order_id (string): Optional. The position of the sentence inside the use case.

Success response

{
  "status": "0",
  "data": 0
}

DELETE /usecase_sentence

Delete an use case-related sentence.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • usca_id (string): Required. Session use case ID. It can contains multiple IDs separated by comma (,).
  • sent_id (string): Required. Session sentence ID. It can contains multiple IDs separated by comma (,).
  • tokens (integer): Optional. Use ‘1’ to subtract the number of tokens that the use case sentence has. Default ‘0’.

Success response

{
  "status": "0",
  "data": "success"
}

PATCH /usecase_sentence

Change the order_id field.

Body

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.
  • usca_id (string): Required. Session use case ID.
  • order_id (string): Required. The position of the sentence inside the use case.
  • direction (string): Required. Indicates if the sentence should be moved up or down (“Up” or “Down”).

Success response

{
  "status": 0,
  "data": "success"
}

Users

Users are people, or machines, making use of this service, including the API.

GET /users

Query existing users, or just current user when it is not an administrator.

  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • email (string): Required for administrators. Email of user to filter.
  • search (string): Optional. Free-text criteria used for search users by name, lastname and email.
  • role (string): Optional. Role to filter user for.
  • enabled (integer): Optional. Used to get users with a specific enabling status.

Success response

{
  "status": 0,
  "data": [
    {
      "id": "1",
      "email": "john@doe.com",
      "name": "John",
      "lastname": "Doe",
      "phone": "1234567",
      "role": "consumer",
      "is_enabled": "1"
    },
    {
      "id": "2",
      "email": "jane@doe.com",
      "name": "Jane",
      "lastname": "Doe",
      "phone": "7654321",
      "role": "admin",
      "is_enabled": "1"
    }
  ]
}

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/api/202203010900​/users.php?session={YOUR-SESSION-TOKEN}&search=user-name&enabled=1&role=admin' );
xhr.send();

POST /users

Create a user.

Body

  • name (string): Required. User name.
  • lastname (string): Required. User lastname.
  • email (string): Required. User email.
  • password (string): Required. User password.
  • phonenumber (string): Required. User phone number.

Success response

{
  "status": 0,
  "data": "success"
}

PATCH /users

Modify only provided user data.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • user_id (integer): Required for administrators. Id of user to be patched. Non-administrators users can only patch themselves.

Body

  • name (string): Optional. User name.
  • lastname (string): Optional. User lastname.
  • phone (string): Optional. User phone number.
  • role (string): Optional. User role (“admin” or “consumer”).
  • enabled (integer): Optional. Use “1” to enable the user, use “0” to disable it.

Success response

{
  "status": 0,
  "data": "success"
}

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.
} );

// put request body.
var requestBody = new FormData();
requestBody.set( 'enabled', 0 );

xhr.open( 'PATCH', 'https://ai.anaimo.com/api/202203010900​/users.php?session={YOUR-SESSION-TOKEN}&user_id=5' );
xhr.send( requestBody );

Zdai DataInput

Manage zdai tables.

GET /zdai

Query content filtering by columns

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 fob for getting data from.
  • group_order (integer): Required. Group and order the query.
  • columns_info (json): Required. A json with the information of the columns you want to use to filter.
  • load_columns (integer): Required. Number of columns to load.

Success response

{"status":"0","data":[{"Cliente":"A","SUM(`Valor`)":"306","Mes":"1"},{"Cliente":"B","SUM(`Valor`)":"9","Mes":"1"},{"Cliente":"A","SUM(`Valor`)":"297","Mes":"2"},{"Cliente":"B","SUM(`Valor`)":"18","Mes":"2"},{"Cliente":"A","SUM(`Valor`)":"288","Mes":"3"},{"Cliente":"B","SUM(`Valor`)":"27","Mes":"3"},{"Cliente":"A","SUM(`Valor`)":"279","Mes":"4"},{"Cliente":"B","SUM(`Valor`)":"36","Mes":"4"},{"Cliente":"A","SUM(`Valor`)":"270","Mes":"5"},{"Cliente":"B","SUM(`Valor`)":"45","Mes":"5"},{"Cliente":"A","SUM(`Valor`)":"261","Mes":"6"},{"Cliente":"B","SUM(`Valor`)":"54","Mes":"6"},{"Cliente":"A","SUM(`Valor`)":"168","Mes":"7"},{"Cliente":"B","SUM(`Valor`)":"42","Mes":"7"},{"Cliente":"A","SUM(`Valor`)":"162","Mes":"8"},{"Cliente":"B","SUM(`Valor`)":"48","Mes":"8"},{"Cliente":"A","SUM(`Valor`)":"156","Mes":"9"},{"Cliente":"B","SUM(`Valor`)":"54","Mes":"9"},{"Cliente":"A","SUM(`Valor`)":"150","Mes":"10"},{"Cliente":"B","SUM(`Valor`)":"60","Mes":"10"},{"Cliente":"A","SUM(`Valor`)":"144","Mes":"11"},{"Cliente":"B","SUM(`Valor`)":"66","Mes":"11"},{"Cliente":"A","SUM(`Valor`)":"138","Mes":"12"},{"Cliente":"B","SUM(`Valor`)":"72","Mes":"12"}]}

Zdao DataOutput

Manage zdao tables.

GET /zdao

Give user summary data.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • job_id (integer): Required. Id of job to get. Default ‘0’.

Success response

{
  "status": 0,
  "data": "success"
}

POST /zdao

Query content filtering by columns.

  • Request type: application/x-www-form-urlencoded
  • Response type: application/json

Params

  • session (string): Required. Session hash.
  • tz (string): Required. Time-Zone identifier. It must be one of the standard timezones.

Body

  • job_id (integer): Required. Id of job to get. Default ‘0’.
  • items (string): Required. Data to replace.
  • values (string): Required. Values to replace.
  • probability (float): Required. A number between 0 and 1.

Success response

{
  "status": 0,
  "data": "success"
}
Table of Contents