Function API

Function API PRODUCT     AVGIDEA, INC. 

Functions created with AFX can be executed, stopped, and status information can be obtained via the API, and API keys can be created in advance for use in applications and shell scripts.


Common Parameters

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"function", "action":"<action>" ... }' https://<endpoint url>

Parameters


% curl -X POST -d "{\"accesskey\":\"<accesskey>\", \"secret\":\"<secretkey>\", \"component\":\"function\", \"action\":\"<action>\" ...}" https://<endpoint url>

Note :
When using curl commands under Windows, use only double quotes and escape within JSON data, as in the example at left.

Executing Functions

Functions created from the ADP console can be executed via API.

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"function", "action":"request", "name":"linetest", "datasource":"ds1", "obj":"data1.csv"}' https://<endpoint url>

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

Parameters

File or Line function

Return value


Stopping Functions

A running function can be stopped via the API. The execution of a function will transition from "running" to "terminated" status.

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"function", "action":"terminate", "id":"Kxf9K3L9T83Ke0pwMIOn"}' https://<endpoint url>

{"data":"Termination request sent","status":"success"}

Parameters

Return value


Listing Function Executions

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"function", "action":"list", "status":"success"}' https://<endpoint url> | jq

{

  "data": [

    {

      "name": "linetest",

      "registeredAt": "2024-04-16T02:23:26.512039Z",

      "id": "Kxf9K3L9T83Ke0pwMIOn",

      "logs": [

        {

          "registeredAt": "2024-04-16T02:23:28.514009Z",

          "text": "Start processing Kxf9K3L9T83Ke0pwMIOn"

        },

        {

          "registeredAt": "2024-04-16T02:23:29.296281Z",

          "text": "Finished processing Kxf9K3L9T83Ke0pwMIOn"

        }

      ],

      "status": "success",

      "updatedAt": "2024-04-16T02:23:29.258Z"

    },

...

}

Parameters

Return value