# Querying Stream Details

#### Function

This API is used to query details about a specified stream.

#### URI

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

Table 1 Path parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
project_id | Yes | String | Project ID.
stream_name | Yes | String | Stream to be queried. Maximum: 60

Table 2 Query parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
start_partitionId | No | String | Name of the partition to start the partition list with. The returned partition list does not contain this partition.
limit_partitions | No | Integer | Maximum number of partitions to list in a single API call. Value range: 1-1,000 Default value: 100 Minimum: 1 Maximum: 1000 Default: 100

#### Request Parameters

Table 3 Request header parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
X-Auth-Token | Yes | String | User token. The token can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

#### Response Parameters

Status code: 200

Table 4 Response body parameters
Parameter | Type | Description
--- | --- | ---
stream_name | String | Name of the stream.
create_time | Long | Time when a stream is created. The value is a 13-bit timestamp.
last_modified_time | Long | Time when a stream is the most recently modified. The value is a 13-bit timestamp.

status

String

Current status of the stream. Possible values:

- CREATING: The stream is being created.

- RUNNING: The stream is running.

- TERMINATING: The stream is being deleted.

- TERMINATED: The stream has been deleted.

Enumeration values:

- CREATING

- RUNNING

- TERMINATING

- FROZEN

stream_type

String

Stream type.

- COMMON: a common stream. The bandwidth is 1 MB/s.

- ADVANCED: an advanced stream. The bandwidth is 5 MB/s.

Enumeration values:

- COMMON

- ADVANCED

partitions | Array of PartitionResult objects | A list of partitions that comprise the DIS stream.

has_more_partitions

Boolean

Specifies whether there are more matching partitions of the DIS stream to list.

- true: yes

- false: no

retention_period | Integer | Period for storing data in units of hours.
stream_id | String | Unique identifier of the stream.

data_type

String

Source data type.

- BLOB: a set of binary data stored in a database management system.

- JSON: an open-source file format that uses readable text to transmit data objects consisting of attribute values or serialized values.

- CSV: a simple text format for storing tabular data in a plain text file. Commas (,) are used as separators by default.

Default value: BLOB

Enumeration values:

- BLOB

- JSON

- CSV

data_schema | String | Source data structure that defines JSON and CSV formats. It is described in the syntax of the Avro schema. For details about Avro, go to http://avro.apache.org/docs/current/

compression_format

String

Compression type of data. Currently, the value can be:

- snappy

- gzip

- zip

Data is not compressed by default.

Enumeration values:

- snappy

- gzip

- zip

csv_properties | CSVProperties object | Attributes of data in CSV format, such as delimiter.
writable_partition_count | Integer | Total number of writable partitions (including partitions in ACTIVE state only).
readable_partition_count | Integer | Total number of readable partitions (including partitions in ACTIVE and DELETED state).
update_partition_counts | Array of UpdatePartitionCount objects | List of scaling operation records.
tags | Array of Tag objects | List of stream tags.
sys_tags | Array of SysTag objects | Enterprise project of a stream.

auto_scale_enabled

Boolean

Specifies whether to enable auto scaling.

- true: auto scaling is enabled.

- false: auto scaling is disabled.

This function is disabled by default.

auto_scale_min_partition_count | Integer | Minimum number of partitions for automatic scale-down when auto scaling is enabled.
auto_scale_max_partition_count | Integer | Maximum number of partitions for automatic scale-up when auto scaling is enabled.

Table 5 PartitionResult
Parameter | Type | Description
--- | --- | ---

status

String

Current status of the partition. Possible values:

- CREATING: The stream is being created.

- ACTIVE: The stream is available.

- DELETED: The stream is being deleted.

- EXPIRED: The stream has expired.

Enumeration values:

- CREATING

- ACTIVE

- DELETED

- EXPIRED

partition_id | String | Unique identifier of the partition.
hash_range | String | Possible value range of the hash key used by the partition.
sequence_number_range | String | Sequence number range of the partition.
parent_partitions | String | Parent partition.

Table 6 CSVProperties
Parameter | Type | Description
--- | --- | ---
delimiter | String | Data separator.

Table 7 UpdatePartitionCount
Parameter | Type | Description
--- | --- | ---
create_timestamp | Long | Scaling execution timestamp, which is a 13-digit timestamp.
src_partition_count | Integer | Number of partitions before scaling.
target_partition_count | Integer | Number of partitions after scaling.
result_code | Integer | Response code of the scaling operation.
result_msg | Integer | Response to the scaling operation.

auto_scale

Boolean

Specifies whether the scaling operation is automatic.

- true: Auto scaling is enabled.

- false: Manual scaling is enabled.

Table 8 Tag
Parameter | Type | Description
--- | --- | ---

key

String

Key.

- This field cannot be left blank.

- The key value of a resource must be unique.

- Character set: A-Z, a-z, 0-9, '-', '_', and Unicode characters (\u4E00-\u9FFF).

Minimum: 1

Maximum: 36

value

String

Value.

- The value contains a maximum of 43 characters.

- Character set: A-Z, a-z, 0-9, '. ', '-', '_', and Unicode characters (\u4E00-\u9FFF).

- The value can contain only digits, letters, hyphens (-), and underscores (_).

Minimum: 0

Maximum: 43

Table 9 SysTag
Parameter | Type | Description
--- | --- | ---

key

String

Key.

- This field cannot be left blank.

- The value must be _sys_enterprise_project_id.

Enumeration values:

- _sys_enterprise_project_id

value

String

Value. The value is the enterprise project ID, which needs to be obtained on the enterprise management page.

- 36-digit UUID

#### Example Requests

Querying Stream Details

    GET https://{Endpoint}/v2/{project_id}/streams/{stream_name}

#### Example Responses

Status code: 200

Normal response.

    {
      "stream_id" : "8QM3Nt9YTLOwtUVYJhO",
      "stream_name" : "newstream",
      "create_time" : 1593569685875,
      "last_modified_time" : "1599050091026,",
      "retention_period" : 24,
      "status" : "RUNNING",
      "stream_type" : "COMMON",
      "data_type" : "BLOB",
      "writable_partition_count" : 1,
      "readable_partition_count" : 1,
      "tags" : [ ],
      "auto_scale_enabled" : false,
      "auto_scale_min_partition_count" : 0,
      "auto_scale_max_partition_count" : 0,
      "partitions" : [ {
        "status" : "ACTIVE",
        "partition_id" : "shardId-0000000000",
        "hash_range" : "[0 : 9223372036854775807]",
        "sequence_number_range" : "[289911 : 289927]"
      } ],
      "has_more_partitions" : false
    }

#### Status Codes

Status Code | Description
--- | ---
200 | Normal response.

#### Error Codes

See Error Codes.

Parent topic: Stream Management