Read Dataset
GET
/v2/datasets/read/{dataset_id}
const url = 'http://localhost:3000/v2/datasets/read/example?mode=edit';const options = { method: 'GET', headers: { Cookie: 'connect.sid=s%3AAYYroI28UhzQVPM909UpLjZlcqMlDMlZ.gAO6bTMTktZi7udh7jntL%2Bw2xVWiI1z6gsSAb3bhZp4' }};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'http://localhost:3000/v2/datasets/read/example?mode=edit' \ --header 'Cookie: connect.sid=s%3AAYYroI28UhzQVPM909UpLjZlcqMlDMlZ.gAO6bTMTktZi7udh7jntL%2Bw2xVWiI1z6gsSAb3bhZp4'This API allows you to read dataset from the requested dataset_id. User can request for the specific fields and status of the dataset through the request params. By default, the API returns the dataset of status “Live”. This API accepts the parameter mode=edit to read the draft dataset. If a draft dataset is not found, it creates one using the live dataset and returns the dataset details.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” dataset_id
required
string
Unique identifier for the dataset
Header Parameters
Section titled “Header Parameters ” Cookie
string
Example
connect.sid=s%3AAYYroI28UhzQVPM909UpLjZlcqMlDMlZ.gAO6bTMTktZi7udh7jntL%2Bw2xVWiI1z6gsSAb3bhZp4Query Parameters
Section titled “Query Parameters ” mode
string
Example
editResponses
Section titled “ Responses ”OK
Media type application/json
object
Examples
Success: Read live dataset
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:38:55+05:30", "params": { "status": "SUCCESS", "resmsgid": "8c8a2852-54bc-43fb-b063-7f359d11930a" }, "responseCode": "OK", "result": { "dataset_id": "master-test", "name": "master-test", "type": "master", "status": "Live", "tags": [], "version": 1, "api_version": "v1", "dataset_config": { "data_key": "userid", "timestamp_key": "", "exclude_fields": [], "entry_topic": "local.masterdata.ingest", "redis_db_host": "localhost", "redis_db_port": 6379, "index_data": true, "redis_db": 54 } }}Success: Read draft dataset
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:41:00+05:30", "params": { "status": "SUCCESS", "resmsgid": "96fd4f42-fa84-4730-bc79-d241a4e335a1" }, "responseCode": "OK", "result": { "dataset_id": "beckn-test-data", "name": "beckn-test-data", "type": "event", "status": "ReadyToPublish", "tags": [], "version": 1, "api_version": "v2", "dataset_config": { "data_key": "", "timestamp_key": "ets", "entry_topic": "beckn-test-data", "redis_db_host": "localhost", "redis_db_port": 6379, "index_data": true, "redis_db": 0, "file_upload_path": [], "exclude_fields": [] } }}Success: Read specific column
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:42:16+05:30", "params": { "status": "SUCCESS", "resmsgid": "02a6b03a-8bf3-4e37-8dcd-859d3e8f904e" }, "responseCode": "OK", "result": { "name": "master-test", "type": "master", "id": "master-test" }}Success: Read version_key
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:45:37+05:30", "params": { "status": "SUCCESS", "resmsgid": "805e848a-d260-47c3-b55c-fc9b8323719e" }, "responseCode": "OK", "result": { "version_key": "1718791650227" }}Success: Read from draft, if not present cerate draft from live dataset and then read
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:49:28+05:30", "params": { "status": "SUCCESS", "resmsgid": "da70e25b-6ad0-49a7-a39d-340d1d0c46a7" }, "responseCode": "OK", "result": { "dataset_id": "sample1", "name": "sample1", "type": "event", "status": "Live", "tags": [], "version": 2, "api_version": "v2", "dataset_config": { "indexing_config": { "olap_store_enabled": true, "lakehouse_enabled": false, "cache_enabled": false }, "keys_config": { "data_key": "", "timestamp_key": "time" }, "cache_config": { "redis_db_host": "localhost", "redis_db_port": 6379, "redis_db": 0 } } }}Headers
Section titled “Headers ” X-Powered-By
string
Example
Express Content-Length
integer
Example
501 ETag
string
Example
W/"1f5-p+b/6r0nHRFhgr5+URzxk4d/CSg" Date
string
Example
Wed, 17 Jul 2024 12:08:55 GMT Connection
string
Example
keep-alive Keep-Alive
string
Example
timeout=5Bad Request
Media type application/json
object
Example
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:50:17+05:30", "params": { "status": "FAILED", "resmsgid": "bccd40ad-db0a-4ed5-984c-e89a9d7b3fdd" }, "responseCode": "BAD_REQUEST", "result": {}, "error": { "code": "DATASET_INVALID_FIELDS", "message": "The specified fields [newname] in the dataset cannot be found." }}Headers
Section titled “Headers ” X-Powered-By
string
Example
Express Content-Length
integer
Example
307 ETag
string
Example
W/"133-TQ9WpmutsrDcTNkRRmbWOhUChMk" Date
string
Example
Wed, 17 Jul 2024 12:20:17 GMT Connection
string
Example
keep-alive Keep-Alive
string
Example
timeout=5Not Found
Media type application/json
object
Example
{ "id": "api.datasets.read", "ver": "v2", "ts": "2024-07-17T17:51:12+05:30", "params": { "status": "FAILED", "resmsgid": "3aad3842-a76e-4fe8-b635-c7fef5f318f9" }, "responseCode": "NOT_FOUND", "result": {}, "error": { "code": "DATASET_NOT_FOUND", "message": "Dataset with the given dataset_id:new_telemetry_record.1 not found" }}Headers
Section titled “Headers ” X-Powered-By
string
Example
Express Content-Length
integer
Example
304 ETag
string
Example
W/"130-JL/oBB+GUHTrBp278giBHRvO71I" Date
string
Example
Wed, 17 Jul 2024 12:21:12 GMT Connection
string
Example
keep-alive Keep-Alive
string
Example
timeout=5