Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: gtema <artem.goncharov@gmail.com> Co-committed-by: gtema <artem.goncharov@gmail.com>
10 KiB
Obtaining Data Cursors
Function
This API is used to obtain data cursors.
URI
GET /v2/{project_id}/cursors
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
stream-name |
Yes |
String |
Name of the stream. |
partition-id |
Yes |
String |
Partition ID of the stream. The value can be in either of the following formats:
For example, if a stream has three partitions, the partition identifiers are 0, 1, and 2, or shardId-0000000000, shardId-0000000001, and shardId-0000000002, respectively. |
cursor-type |
No |
String |
Cursor type.
Enumeration values:
|
starting-sequence-number |
No |
String |
Serial number. A sequence number is a unique identifier for each record. DIS automatically allocates a sequence number when the data producer calls the PutRecords operation to add data to the DIS stream. SN of the same partition key usually changes with time. A longer interval between PutRecords requests results in a larger sequence number. The sequence number is closely related to cursor types AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER. The two parameters determine the position of the data to be read. Value range: 0 to 9,223,372,036,854,775,807 |
timestamp |
No |
Long |
Timestamp when the data record starts to be read, which is closely related to cursor type AT_TIMESTAMP. The two parameters determine the position of the data to be read. Note: The timestamp is accurate to milliseconds. |
Request 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
Parameter |
Type |
Description |
---|---|---|
partition_cursor |
String |
Data cursor. Value range: a string of 1 to 512 characters Note: The validity period of a data cursor is 5 minutes. Minimum: 1 Maximum: 512 |
Example Requests
Obtaining Data Cursors
GET https://{Endpoint}/v2/{project_id}/cursors
Example Responses
Status code: 200
Normal response.
{ "partition_cursor" : "eyJnZXRJdGVyYXRvclBhcmFtIjp7InN0cmVhbS1uYW1lIjoianpjIiwicGFydGl0aW9uLWlkIjoiMCIsImN1cnNvci10eXBlIjoiQVRfU0VRVUVOQ0VfTlVNQkVSIiwic3RhcnRpbmctc2VxdWVuY2UtbnVtYmVyIjoiMTAifSwiZ2VuZXJhdGVUaW1lc3RhbXAiOjE1MDYxNTk1NjM0MDV9" }
Status Codes
Status Code |
Description |
---|---|
200 |
Normal response. |
Error Codes
See Error Codes.