Datasource API

Datasource API PRODUCT     AVGIDEA, INC. 

Obtain information about the Datasource and execute SQL against the database to which it is connected.


Common parameters

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"storage", "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.

Obtaining a list of datasources

% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"datasource", "action":"list"}' https://<endpoint url> | jq

{

  "data": [

    {

      "description": "description1",

      "name": "as1",

      "registeredAt": "2024-09-03T05:30:18.188Z",

      "type": "as",

      "value": "as://data1"

    },

   ...

  ],

  "status": "success"

}

Parameters

Return value


Obtaining a list of datasources (with conditions)

% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"datasource", "action":"list", "datasource":"orcl", "type":"oc"}' https://<endpoint url> | jq

{

  "data": [

    {

      "description": "Oracle database",

      "name": "orcl",

      "registeredAt": "2024-09-03T05:30:18.188Z",

      "type": "oc",

      "value": "<hostname>:1521/orcl"

    }

  ],

  "status": "success"

}

Parameters

Return value


Confirmation of Connection to Database

You can check the availability of the connection from ADP to the database to which you are connecting.

% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"datasource", "action":"connect", "datasource":"orcl"}' https://<endpoint url> | jq

{

  "data": {

    "host": "<hostname>",

    "name": "orcl",

    "port": "1521",

    "service": "orcl",

    "type": "oc",

    "uname": "admin",

    "value": "<hostname>:1521/orcl"

  },

  "status": "success"

}

Parameters

Return value


SQL Execution (DDL)

% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"datasource", "action":"execute", "datasource":"orcl", "statement":"create table simple(id varchar2(64), num number, dt date)"}' https://<endpoint url> | jq



Parameters

Return value


SQL Execution (DML)

% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"datasource", "action":"execute", "datasource":"orcl", "statement":"insert into simple values (:1, :2, :3)", "args": ["abcde", 1, "2024/11/12 13:22:00"], "session":{"NLS_DATE_FORMAT":"YYYY/MM/DD HH24:MI:SS"}}' https://<endpoint url> | jq



Parameters

Options

Return value


SQL Execution (SELECT)

% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"datasource", "action":"execute", "datasource":"orcl", "query":"select * from employees","session":{"DATE_FORMAT":"2006-01-02"}}' https://<endpoint url> | jq

{

  "data": [

    [

      "EMPLOYEE_ID",

      "FIRST_NAME",

      "LAST_NAME",

      "EMAIL",

      "HIRE_DATE",

      "JOB_ID",

      "SALARY",

      "MANAGER_ID",

      "DEPARTMENT_ID"

    ],

    [

      "e366",

      "Amanda",

      "Maldonado",

      "amanda.maldonado@example.com",

      "2023-01-09",

      "IT_PROG",

      "73498.98",

      "73",

      "30"

    ],

  ...

  "status": "success"

}

Parameters

Options

Return value