Endpoints

Endpoints

List data sources

This endpoint lists all data sources associated with your Internal account.

Path: /api/v1/data_sources

Query parameters:

  • page: Optional, the page number to load (defaults to 1).
  • page_size: Optional, the number of data sources to list per page (defaults to 30, max of 100).

Response fields:

  • data_sources: data_sources: An array of data source objects with the following properties:
    • id: The id of the data source.
    • title: The name of the data source.

Example:

  
curl -u int_...eJVy: https://secure.internal.io/api/v1/data_sources
  
  
{
  "data_sources": [
    { "id": "757fcf6a-7122-4c8f-9dbb-075b982727e1", "title": "PostgreSQL" },
    { "id": "dedd3c9a-dcaa-42d1-96b6-e15381f0e3f8", "title": "HTTP" }
  ]
}
  

List a data source's functions

This endpoint lists all functions defined on a data source. Only functions that the API key has permissions to execute are returned.

Path: /api/v1/data_sources/:data_source_id/functions

Query parameters:

  • page: Optional, the page number to load (defaults to 1).
  • page_size: Optional, the number of data sources to list per page (defaults to 30, max of 100).

Response fields:

  • functions: An array of function objects with the following properties:
    • id: The id of the function
    • title: The title of the function
    • parameters: The array of function parameters with the following properties:
      • name: The name of the parameter.
      • type: The type of the parameter (one of: binary, bool, date, datetime, decimal, file, float, int, json, multipart, string, time, timestamp)
      • required: Whether the parameter is required.

Example:

  
curl -u int_...eJVy: \
  https://secure.internal.io/api/v1/data_sources/dedd3c9a-dcaa-42d1-96b6-e15381f0e3f8/functions
  
  
{
  "functions": [
    {
      "id": "7efc014b-525d-404e-b9fd-94dde87bcb70",
      "title": "Request",
      "parameters": [
        { "name": "path", "type": "string", "required": true },
        { "name": "query", "type": "json", "required": false },
        { "name": "header", "type": "json", "required": false },
        { "name": "method", "type": "string", "required": true },
        { "name": "raw_body", "type": "string", "required": false },
        { "name": "form_body", "type": "json", "required": false },
        { "name": "json_body", "type": "json", "required": false },
        { "name": "binary_body", "type": "binary", "required": false },
        { "name": "multipart_body", "type": "multipart", "required": false }
      ]
    },
    {
      "id": "b20a2e74-aebd-4803-b829-04343ec0457f",
      "title": "GET /",
      "parameters": [{ "name": "path", "type": "int", "required": false }]
    }
  ]
}
  

Get function

This endpoint gets a function. A function is returned only if the API key has permissions to execute that function.

Path: /api/v1/functions/:id

Response fields:

  • functions: The function object with the following properties:
    • id: The id of the function
    • title: The title of the function
    • parameters: The array of function parameters with the following properties:
      • name: The name of the parameter.
      • type: The type of the parameter (one of: binary, bool, date, datetime, decimal, file, float, int, json, multipart, string, time, timestamp)
      • required: Whether the parameter is required.

Example:

  
curl \
  -H "content-type: application/json" \
  -u int_...eJVy: \
  https://secure.internal.io/api/v1/functions/b20a2e74-aebd-4803-b829-04343ec0457f
  
  
{
  "function": {
    "id": "b20a2e74-aebd-4803-b829-04343ec0457f",
    "title": "GET /",
    "parameters": [
      { "name": "path", "type": "int", "required": false }
    ]
  }
}
  

Execute function

This endpoint executes a function. Only functions that the API key has permissions to execute are executed.

Method: POST Path: /api/v1/executions

Request parameters:

  • function_id: Required, the id of the function to execute.
  • values: Optional, an object containing the values to execute the function with.

Response fields:

  • data: The data returned by the function.
  • metadata: The metadata returned by the function.

Example:

  
curl \
  -H "content-type: application/json" \
  -u int_...eJVy: \
  -d '{"function_id": "b20a2e74-aebd-4803-b829-04343ec0457f", "values": {}}' \
  https://secure.internal.io/api/v1/executions
  
  
{
  "data": "\n\n...\n",
  "metadata": {
    "http": {
      "request": {
        "body": "",
        "headers": { "User-Agent": "Internal/1.0 (+https://internal.io/)" },
        "method": "GET",
        "url": "https://example.com"
      }
    }
  }
}
  

List environments

This endpoint returns a paginated list of the ids and titles of environments visible to the current user. Environment IDs can be passed into calls to the Function Execution endpoint (above) using environment_id as a key in the body of the POST. Omitting the environment_id results in the default environment's ID being passed into the execution.

Path: /api/v1/environments

Response fields:

  • environments: The ID and title of the environments visible to the current user.

Example:

  
curl \
  -u int_...eJVy: \
  https://secure.internal.io/api/v1/environments
  
  
{
  "environments": [
    {
      "id": "ab940767-7516-41e5-8cd3-f4f0cb74b012",
      "title": "Default"
    },
    {
      "id": "f2ecb8c1-c7ab-4917-b5b2-da7a4e122f4a",
      "title": "Other"
    }
  ]
}
  

Creating and execution in a non-default environment example:

  
curl -u 'int_...9MdG:' \
  -H 'Content-Type: application/json' \
  -d '{"environment_id": "f2ecb8c1-c7ab-4917-b5b2-da7a4e122f4a", "function_id": "ba1f480e-6b9c-4d2c-ba4e-e13f2d59ec40", "values": {"sql": "select 1", "arguments": []}}' \
  http://secure.internal.io/api/v1/executions
  
  
{
  "data": [
    {
      "?column?": 1
    }
  ],
  "metadata": null
}