Help Center/ DataArts Studio/ API Reference/ DataArts Factory APIs (V1)/ Script Development APIs/ Querying the Execution Result of a Script Instance
Updated on 2024-11-06 GMT+08:00

Querying the Execution Result of a Script Instance

Function

This API is used to obtain the execution status and result of a script instance.

During the query, specify the script name and script instance ID.

URI

  • URI format

    GET /v1/{project_id}/scripts/{script_name}/instances/{instance_id}

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain a project ID, see Project ID and Account ID.

    script_name

    Yes

    String

    Script name.

    instance_id

    Yes

    String

    Script instance ID. For details about how to obtain the ID, see the response parameters in Executing a Script.

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

workspace

No

String

Workspace ID.

  • If this parameter is not set, data in the default workspace is queried by default.
  • To query data in other workspaces, this header must be carried.

Response Parameters

Table 3 Response parameters

Parameter

Mandatory

Type

Description

status

Yes

String

Execution status.

LAUNCHING: The script instance is being submitted.

RUNNING: The script instance is running.

FINISHED: The script instance is successfully run.

FAILED: The script instance fails to be run.

results

Yes

List<Result>

Execution result of the script instance.

message

No

String

Execution failure message

Table 4 Result data structure description

Parameter

Mandatory

Type

Description

message

No

Object

Returned message

schema

No

List<Map<String, String>>

Metadata information

rows

No

List<List<Object>>

Result data

rowCount

No

Long

Number of the result rows

inputRowCount

No

Long

Number of the input result rows. (This result is returned when scripts such as DLI scripts are executed.)

resultCount

No

Long

Number of the result rows. (This result is returned when scripts such as DLI scripts are executed.)

duration

No

Float

Duration of executing the script instance. Unit: second

rawResult

No

Map<String, Object>

Script execution result

Example Request

GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/scripts/dwsscript/instances/a1ad-448a-9d56-4154193d49c5

Example Response

  • Success response

    HTTP status code 200

    {
    	"results": [{
    		"message": "",
                    "duration":0.5,
    		"rowCount": 1,
    		"rows": [[913460.0,
    		765.0,
    		"8/31/2015 23:26",
    		"Harry Bridges Plaza (Ferry Building)",
    		50.0,
    		"8/31/2015 23:39",
    		"San Francisco Caltrain (Townsend at 4th)",
    		70.0,
    		"288",
    		"Subscriber",
    		"2139"]],
    		"schema": [{
    			"TripID": "int"
    		},
    		{
    			"Duration": "int"
    		},
    		{
    			"StartDate": "string"
    		},
    		{
    			"StartStation": "string"
    		},
    		{
    			"StartTerminal": "int"
    		},
    		{
    			"EndDate": "string"
    		},
    		{
    			"EndStation": "string"
    		},
    		{
    			"EndTerminal": "int"
    		},
    		{
    			"Bike": "string"
    		},
    		{
    			"SubscriberType": "string"
    		},
    		{
    			"ZipCode": "string"
    		}]
    	}],
    	"status": "FINISHED"
    }
  • Failure response

    HTTP status code 400

    {
        "error_code":"DLF.6201",
        "error_msg":"The script does not exist."
    }

Status Codes

See Status Codes.