Listing datastreams in Management API#
This guide explains how to list datastreams with the v1 endpoint
GET /api/v1/datastreams/, which filters on and returns the following:
datastream UUIDs
workspaces
enabled state
pulling mode and schedules
tags
The v1 endpoints follow their own conventions for authentication,
identifiers, pagination, filters, and errors. For more information, see
Working with v1 endpoints.
Prerequisites#
Before you complete the procedures in this guide, perform the following action:
Use a Connect API key with Datastream: Read-only (
datastream:read). Datastream: Write also works. Without this permission, Management API returns HTTP403. You cannot change the permissions of a key, so to add one, create a new key. For more information, see Creating a Connect API key in Adverity.
Listing datastreams#
To list datastreams, follow these steps:
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/v1/datastreams/
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}.Optionally, add query parameters to filter the results. If you combine several parameters, the response contains only the datastreams that match all of them.
Parameter
Description
datastream_idOnly the datastreams with these UUIDs. Repeat the parameter for several values, up to 50.
workspace_idOnly the datastreams that belong directly to these workspaces. datastreams in child workspaces are not included. Repeat the parameter for several values, up to 50.
workspace_scopeancestors,descendants, orfamily: only the datastreams in the workspace given byscope_from_workspace_idand the workspaces above it, below it, or both.scope_from_workspace_idThe workspace UUID that
workspace_scopestarts from. Required when the instance has more than one top-level workspace.enabledtruefor enabled datastreams only,falsefor disabled datastreams only.active_pulling_modeOnly the datastreams whose active pulling mode is
smart,smart-bundle, orschedule.scheduled_deletiontruefor datastreams scheduled for deletion only,falseto exclude them. Omit the parameter to return both.tagOnly the datastreams with a tag of this name, ignoring case. The name matches in every workspace the key can see. To match the tag of one workspace only, add
workspace_id. Repeat the parameter for several names, up to 50. For more information, see Tagging datastreams in Management API.tag_matchany(default) for the datastreams with at least one of the given tags,allfor the datastreams with every given tag.pageThe page number, starting at
1. Default:1.page_sizeThe number of items per page. Default:
50. Values above100return100items.Send the request.
As a result, you obtain the datastreams that the key can see, in the order they were created.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/v1/datastreams/?enabled=true&page_size=100' \
--header 'Authorization: Bearer {{KEY}}'
The example response below shows one datastream with a custom fetch schedule:
{
"items": [
{
"id": "{{DATASTREAM_UUID}}",
"name": "{{DATASTREAM_NAME}}",
"enabled": true,
"workspace": {
"id": "{{WORKSPACE_UUID}}",
"name": "{{WORKSPACE_NAME}}"
},
"tags": [
{
"id": "{{TAG_UUID}}",
"name": "prod"
}
],
"pulling": {
"active_mode": "schedule",
"smart": null,
"smart_bundle": null,
"schedule": [
{
"id": 4821,
"cron_type": "day",
"cron_interval": 1,
"cron_interval_start": 1,
"cron_start_of_day": "03:00:00",
"cron_preset": "CRON_EVERY_DAY",
"time_range_preset": 4,
"time_range_preset_label": "Last 7 Days",
"delta_type": "day",
"delta_interval": 1,
"delta_interval_start": 1,
"delta_start_of_day": "00:00:00",
"offset_days": 0,
"fixed_start": null,
"fixed_end": null,
"not_before_date": null,
"not_before_time": null
}
]
}
}
],
"count": 1
}
Response fields#
Each item in items has the following fields:
Field |
Description |
|---|---|
|
The datastream UUID. Use it wherever a |
|
The datastream name. |
|
|
|
The UUID of the workspace the datastream belongs to. |
|
The name of the workspace the datastream belongs to. |
|
The tags of the datastream, each with its |
|
The schedule type that is active: |
|
The smart schedule configuration, or |
|
The smart bundle schedule entries, or |
|
The custom fetch schedule entries, or |
A datastream can have several schedule configurations stored at once, for
example a custom fetch schedule it used before switching to smart schedule.
pulling.active_mode tells you which one runs.
To read fields that this endpoint does not return, such as the connector
configuration, use the legacy endpoint
GET /api/datastreams/{{DATASTREAM_ID}}/. For more information, see
Configuring datastreams in Management API.