Updated on 2022-02-22 GMT+08:00

Getting Started

This section describes the procedure for executing a job by calling the API.

  1. Use the token authentication to obtain the user token, which will be put into the request header for authentication in a subsequent request.
  2. Execute the job.

Prerequisites

Procedure

The following value settings are used as an example:

  • IAM endpoint: iam_endpoint
  • Data Development endpoint: dlf_endpoint
  • Project ID: project_id
Perform the following operations to create an application.
  1. Use the token authentication API to obtain the user token and set it as an environment variable.
    curl -H "Content-Type:application/json" https://{iam_endpoint}/v3/auth/tokens -X POST -d '{
           "auth": {
               "identity": {
                   "methods": [
                       "password"
                   ],
                   "password": {
                       "user": {
                           "name": "testname",
                           "domain": {
                               "name": "testname"                                          },
                           "password": "Passw0rd"                                      }
                     }           
               },
               "scope": {
                   "project": {
                       "name": "ap-southeast-1"
                   }
               }       
          }   
    }' -v -k

    The value of X-Subject-Token in the response header is the token.

    X-Subject-Token:MIIDkgYJKoZIhvcNAQcCoIIDgzCCA38CAQExDTALBglghkgBZQMEAgEwgXXXXX...

    Run the following command to set the token as an environment variable for future use:

    export Token={X-Subject-Token}

    Replace X-Subject-Token with the token obtained in the preceding step.

    export X-Auth-Token=MIIDkgYJKoZIhvcNAQcCoIIDgzCCA38CAQExDTALBglghkgBZQMEAgEwgXXXXX...
  2. Call the API to execute the job.
    curl -H "Content-Type:application/json" https://{dlf_endpoint}/v1.0/{project_id}/pipelines/run-pipeline -X POST -d '
    {
    "pipelineId": "b9636fa3-048f-495e-a33f-74b2744801ec"
    }
    

    If the returned status code is 200, the job is successfully executed.