Help Center> Data Ingestion Service> API Reference> API Description> Obtaining Stream Consumption Information

Obtaining Stream Consumption Information

Function

This API is used to obtain stream consumption information.

When obtaining the stream consumption information, you need to specify the stream name and application name.

URI

  • URI format

    GET /v2/{project_id}/apps/{app}/streams/{stream_name}

  • Parameter description

    None

Request

  • Example request
    GET https://{endpoint}/v2/{project_id}/apps/app_name/streams/stream_name?checkpoint_type=LAST_READ&start_partition_id=0&limit=3
    • Parameter description
      Table 1 Parameter description

      Parameter

      Mandatory

      Type

      Description

      limit

      No

      Int

      The number of partitions whose consumption states will be returned.

      Value range: 1 to 100

      Default: 100

      start_partition_id

      No

      String

      Start partition ID for obtaining flow consumption information.

      Value range: 0 to (the total number of partitions – 1)

      Default: 0

      checkpoint_type

      Yes

      String

      Type of the checkpoint.

      Set this parameter to LAST_READ.

      app

      Yes

      String

      Name of the application.

      stream_name

      Yes

      String

      Name of the stream created on the management console.

      A stream name is 1 to 64 characters long. Only letters, digits, hyphens (-), and underscores (_) are allowed.

    Response

    • Example response
      {
      "stream_name":"${name}",
      "app_name":"5395527",
      "partition_consuming_states":[
      {
      "partition_id":"2",
      "sequence_number":"-1",
      "latest_offset":"0",
      "earliest_offset":"0",
      "checkpoint_type":"LAST_READ"}
      
      ]
      }
    • Parameter description
      Table 2 Response parameter description

      Parameter

      Type

      Description

      stream_name

      String

      Name of the DIS stream.

      app_name

      String

      Name of the application.

      partition_consuming_states

      List<partition_consuming_state>

      Consumption state of each partition.

      has_more

      Boolean

      Whether consumption states of other partitions are available.

      Table 3 Partition_consuming_state parameter description

      Parameter

      Type

      Description

      partition_id

      String

      Unique identifier of the partition.

      sequence_number

      String

      Sequence number. The sequence number is defined in the API request in Adding a Checkpoint.

      NOTE:

      If the checkpoint is not submitted or has been deleted, the value is -1.

      latest_offset

      Long

      Latest offset of the partition data.

      earliest_offset

      Long

      Earliest offset of the partition data.

      checkpoint_type

      String

      Type of the checkpoint. Set this parameter to LAST_READ.

      metadata

      String

      Metadata of the checkpoint. For details, see Adding a Checkpoint.

Response Code

  • Normal

    200 OK

  • Failed

    For more information, see Error Codes.