Skip to main content
https://cloud.cdata.com/api

Authentication

All requests to the Connect AI API must be properly authenticated using either OAuth or Basic Authentication. See Authentication for details.

Workspaces

To query a workspace, add a URL parameter to the REST API URL named “workspace”. Set this to the name of the workspace you want to query. This works with both the GET operation on the metadata endpoint, as well as the POST operation on the query and batch endpoints. Note that the /exec endpoint does not support workspaces.

Response Format

Operations in the Connect AI API share a common response format which, depending on the operation, may include:
  • One or more result sets with:
    • Result column metadata
    • Row values, if any
    • Affected row count
  • Output and return parameters (for applicable stored procedure executions)
  • Any error that may have occurred prior to, during, or after request processing
The response objects returned by the API contain one or more of the top-level properties shown below:
{
  "results": [
    {
      "schema": [
        {
          "ordinal": <int>,
          "catalogName": "<string>",
          "schemaName": "<string>",
          "tableName": "<string>",
          "columnName": "<string>",
          "columnLabel": "<string>",
          "dataType": <int>,
          "dataTypeName": "<string>",
          "length": <int>,
          "precision": <int>,
          "scale": <int>,
          "nullable": <bool>
        },
        ...
      ],
      "rows": [
        [<any>, <any>, ...],
        ...
      ],
      "affectedRows": <int>,
    },
    ...
  ],
  "parameters": {
    "@p1": { "dataType": <int>, "direction": <int>, "value": <any> }
    ...
  },
  "error": {
    "code": "<string>",
    "message": "<string>"
  }
}

Properties

PropertyDescription
resultsArray of result sets for the query, one object per result set.
schemaArray of column schema for the result set.
ordinalThe position of the column in the result set. 0-based.
catalogNameName of the column’s catalog.
schemaNameName of the column’s schema.
tableNameName of the column’s table.
columnNameThe column’s name.
columnLabelThe column’s label.
dataTypeThe column’s data type.
dataTypeNameName of the column’s data type. May be data-source-specific.
lengthFor binary/string columns, the maximum number of characters. For other data types, the display length.
precisionThe column’s precision. Omitted if not applicable.
scaleThe column’s scale. Omitted if not applicable.
nullableWhether the column is nullable.
rowsAn array of row value arrays. Each nested array represents a row in the result set, and contains the row’s values for each column.
affectedRowsThe number of affected rows, or -1 if not applicable/available.
parametersAny output, in/out, or return parameters produced by a stored procedure. Omitted if there are no such parameters in the result.
dataTypeThe parameter’s data type.
directionThe parameter’s direction: 2 for in/out, 4 for output, or 5 for return.
valueThe parameter’s value.
errorInformation about the error which occurred. Omitted if no error occurred.
codeThe error code.
messageThe error message.

Errors

When Connect AI receives an API request, it validates it, executes it, and then serializes and streams back the results as they arrive. If an error occurs prior to or during execution, the response object only contains error information. However, it is also possible for errors to occur after a query’s results have started being returned. In such cases, the response object may contain both a partial result as well as error information stating that the result is incomplete. Since the HTTP status code is returned before the body, incomplete responses have a 200 OK status. As such, it’s important that you always check for the presence of error information in the response rather than relying solely on the HTTP status code.

Data Types

The following table shows the valid values for the dataType property in the Result Set Serialization.
ValueMeaningRepresentation
1BINARYJSON String; Base64-encoded
5VARCHARJSON String
6TINYINTJSON Number
7SMALLINTJSON Number
8INTEGERJSON Number
9BIGINTJSON Number
10FLOATJSON Number
11DOUBLEJSON Number
12DECIMALJSON String; format: valid JSON number
13NUMERICJSON String; format: valid JSON number
14BOOLEANJSON Boolean (true/false)
15DATEJSON String; format: yyyy-MM-dd
16TIMEJSON String; format: HH:mm:ss.fffffff
17TIMESTAMPJSON String; ISO8601 format: yyyy-MM-ddTHH:mm:ss.fffffffZ
18UUIDJSON String; format: {01234567-890a-bcde-f012-34567890abcd}