Cloud service invocation instructions

Updated at:

This topic describes how to invoke cloud services using a canvas or a node.

Prerequisites

Canvas invocation

  • Synchronous call

    The request parameters are as follows:

    Table 1

    Field

    Type

    Required

    Description

    serviceId

    String

    Yes

    The service ID.

    type

    String

    Yes

    Enter "EXPERIMENT".

    jobId

    String

    Yes

    The job ID. It must be globally unique.

    It consists of lowercase letters and numbers.

    params

    String

    No

    The JSON string of canvas parameters. It must conform to the standard structure. For example:

    {

    "key1": {

    "value": "",

    "quality": 192

    }

    }

    Response:

    {
      "code":"200",
      "data": "JSON string",
      "success":true,
      "message":"success"
    }

    The data structure of the data field is as follows:

    {
            "v1": {
                "type": "Int",
                "value": "",
                "keyName": "",
                "quality": 192
            },
            "v2": {
                "type": "Int",
                "value": "",
                "keyName": "",
                "quality": 192
            }
    }
  • Asynchronous invocation

    The request parameters are the same as those for a synchronous call. For more information, see Table 1.

    The response is as follows:

    {
      "code":"200",
      "data": "JSON string",
      "success":true,
      "message":"success"
    }

    The data structure of the data field is as follows:

    {
            "jobId": "69955074c9f344e5a087e2a87bae5cd0",
            "jobStatus": "RUNNING",
            "experimentId": null,
            "nodes": [
                {
                    "nodeId": "102580",
                    "componentId": "Csv",
                    "status": "UNSTARTED",
                    "startTime": "0",
                    "endTime": "0",
                    "info": "UNSTARTED"
                },
                {
                    "nodeId": "102508",
                    "componentId": "NewPythonCode",
                    "status": "UNSTARTED",
                    "startTime": "0",
                    "endTime": "0",
                    "info": "UNSTARTED"
                },
                {
                    "nodeId": "102190",
                    "componentId": "NewAlgo",
                    "status": "UNSTARTED",
                    "startTime": "0",
                    "endTime": "0",
                    "info": "UNSTARTED"
                }
            ]
        }

    The callback request parameters are as follows:

    {
        "serviceId": "", // The service ID
       "jobId":"",
        "data": "JSON string"
    }

    The data structure of the data field is as follows:

    {
            "v1": {
                "type": "Int",
                "value": "",
                "keyName": "",
                "quality": 192
            },
            "v2": {
                "type": "Int",
                "value": "",
                "keyName": "",
                "quality": 192
            }
        }

Node invocation

  • Synchronous call

    The request parameters are as follows:

    Table 2

    Field

    Type

    Required

    Description

    serviceId

    String

    Yes

    The service ID.

    nodeId

    String

    Yes

    The node ID.

    type

    String

    Yes

    Enter "EXPERIMENT".

    jobId

    String

    Yes

    The job ID. It must be globally unique.

    It consists of lowercase letters and numbers.

    params

    String

    No

    The node algorithm parameters.

    The response is as follows:

    {
      "code":"200",
      "data": "JSON string",
      "success":true,
      "message":"success"
    }

    The data structure of the data field is the result returned by the algorithm.

  • Asynchronous invocation

    The request parameters are the same as those for a synchronous call. For more information, see Table 2.

    The response is as follows:

    {
      "code":"200",
      "data": "JSON string",
      "success":true,
      "message":"success"
    }

    The data structure of the data field is the result returned by the algorithm.

    The callback request parameters are as follows:

    {
        "serviceId": "", // The service ID
       "jobId":"",
        "data": "JSON string"
    }

    The data structure of the data field is the result returned by the algorithm.