Updated on 2026-11-06 GMT+08:00

Using APIs to Connect to an AuraJobV2 Endpoint and Submit Jobs

You can use APIs to connect to an AuraJobV2 endpoint when you need to integrate data processing capabilities into your service system, or automatically submit Aura jobs and query job status programmatically. AI DataLake provides standard RESTful APIs that you can call programmatically.

Prerequisites

  • An AuraJobV2 endpoint has been created and is in the Running state. For details, see Creating an Aura Engine Endpoint.
  • You have obtained the workspace ID and the AuraJobV2 endpoint name.
  • You have obtained the LakeFormation catalog name.

Step 1: Create a Session

  1. Use an API tool, such as Postman, to call the API to connect to the AuraJobV2 endpoint.

    For details about calling APIs, see Calling APIs.

    An example request is as follows:

    POST /v2/workspaces/{workspace_id}/aura-sessions
    
    {
      "endpoint_name" : "aura-job-iqr0",
      "catalog_context" : {
        "catalog_name" : "aurasql_default"
      }
    }

    Table 1 describes the parameters. For more information, see Creating a Session.

    Table 1 Parameter description

    Parameter

    Description

    Example Value

    workspace_id

    ID of the workspace.

    302ce559-9759-4586-9885-90d6c0b4****

    endpoint_name

    The name of the Aura endpoint.

    aura-job-iqr0

    catalog_name

    The name of the LakeFormation catalog.

    aurasql_default

  2. If a response similar to the following is returned, the AuraJobV2 endpoint is successfully connected:

    {
      "session_id" : "ac8111bf-3601-4905-8ddd-b41d3e63****",
      "status" : "RUNNING"
    }

Step 2: Submit Jobs

After creating a session, you can use an API to submit SQL jobs in that session.

  1. Use an API tool, such as Postman, to call the API to execute SQL jobs within a specified session.

    An example request is as follows:

    POST /v2/workspaces/{workspace_id}/aura-sessions/statements
    
    {
      "statement" : "select version();",
      "session_id" : "string",
      "is_sync" : true
    }

    Table 2 describes the parameters. For more information, see Executing SQL Statements Under a Specified Session.

    Table 2 Parameter description

    Parameter

    Description

    Example Value

    workspace_id

    ID of the workspace.

    302ce559-9759-4586-9885-90d6c0b4****

    statement

    Details about the SQL job.

    select version();

    session_id

    ID of the session.

    ac8111bf-3601-4905-8ddd-b41d3e63****

    is_sync

    The execution mode, which can be synchronous or asynchronous. Value range:

    • true: Synchronous
    • false: Asynchronous

    true

  2. If a response similar to the following is returned, the SQL job has been successfully submitted:

    {
        "status": 0,
        "session_id": "01a0c85e-330d-7fca-93bf-2b5f04cd****",
        "statement_id": "01a0c85e-6167-7f84-bad7-267caa5e****",
        "retry_flag": "NONE",
        "results": [
            {
                "status": "PGRES_TUPLES_OK",
                "statement_id": "01a0c85e-6167-7f84-bad7-267caa5e****",
                "num_rows": 1,
                "row_count": 1,
                "page_count": 1,
                "page_no": 1,
                "err_code": "0",
                "sql_state": "0",
                "message": "",
                "result_set": {
                    "columns": [
                        {
                            "name": "version",
                            "table_id": 0,
                            "column_id": 0,
                            "format": 0,
                            "type": 25,
                            "size": -1,
                            "type_mod": -1
                        }
                    ],
                    "rows": [
                        [
                            "PostgreSQL 9.2.4 (Aura 26.9.0 build bf546b91) compiled at 2026-09-18 13:21:04 commit 3130 last mr 3769  YR SDK version 205.0.0.B021 release"
                        ]
                    ]
                }
            }
        ]
    }

Related Operations

  • After executing a SQL statement in a specified session, you can call an API to query the execution results. For details, see Viewing SQL Statement Execution Results.
  • After completing the required operations, you can call an API to close the session. For details, see Closing a Session.