Updated on 2025-05-29 GMT+08:00

Creating a Query Task

Function

Create a query task.

Precautions

None

Calling Method

POST

URI

/meter/v1/{domain_id}/query-jobs

Path parameters

Parameter

Mandatory

Type

Value Range

Description

domain_id

Yes

string

Regular expression: ^[-_0-9a-zA-Z]{0,36}$

Tenant ID of ESM.

Query parameters

None

Request

  • Request header parameters

    For details, see the header description in the sample request.

  • Request body parameters
    Table 1 CreateQueryJobRequest object attributes

    Parameter

    Mandatory

    Type

    Value Range

    Description

    hcso_id

    No

    string

    Regular expression: ^[-_0-9a-zA-Z]{0,36}

    hcso id

    region_id

    No

    string

    Regular expression: ^[-_0-9a-zA-Z]{0,255}

    hcso id

    min_sdr_time

    No

    string

    Regular expression: ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$

    Time when you start querying SDRs: 2022-01-01 00:00:00

    max_sdr_time

    No

    string

    Regular expression: ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$

    Time when you stop querying SDRs: 2022-01-31 00:00:00

  • Sample request
    POST /meter/v1/{domain_id}/query-jobs HTTP/1.1
    Host: example.com
    Content-Type: application/json
    Accept: application/json
    X-Auth-Token: xxx
    { 
        "hcso_id": "xxx", 
        "region_id": "region", 
        "min_sdr_time": "2022-01-01 00:00:00", 
        "max_sdr_time": "2022-02-01 00:00:00" 
    }

Response

  • Response parameters
    • Response status code: 201. CreateQueryJobResponse is returned.
      Table 2 CreateQueryJobResponse object attributes

      Parameter

      Mandatory

      Type

      Value Range

      Description

      job_id

      No

      string

      None

      Task ID

  • Sample response
    HTTP/1.1 201 OK
    Date:Tue,18 Jul 2023 09:58:01 GMT
    Server: example.com
    Content-Type: application/json;charset=UTF8
    { 
        "job_id": "xxx" 
    }

Status Codes

Table 3 Status codes

Status Code

Description

201

Operation successful.

400

Parameter error.

401

Token authentication failed.

403

Authentication failed.

404

The REST API was not found.

500

Internal error.

Operation Severity

Minor