Get segments
Retrieve a list of available data source logins (authentications) and their segments.
GET
https://api.supermetrics.com/enterprise/v2/query/segments
-
api_key
string
Conditional. API key when not using an authorization header. See authentication for more.
-
ds_id
string
Required. Data source ID. See data sources for more.
-
ds_users
string | string[]
Optional. List of data source login usernames to target. Case-insensitive.
-
cache_minutes
integer
Optional. Maximum allowed age of cache in minutes. Defaults to none for last fetched information. Value range of 60 minutes and 1440 minutes is enforced. Minimum and maximum values are subject to license restrictions.
Request
HTTP
Postman examples
GET https://api.supermetrics.com/enterprise/v2/query/segments?json={
"api_key": "<api key>",
"ds_id": "GA",
"ds_users": "info@supermetrics.com"
}
Response
Property | Type | Description |
meta > request_id | string | API request ID |
meta > query > cache_minutes | integer | Requested maximum age of cache in minutes with minimum and maximum value enforced. Defaults to null. |
data > * > ds_user | string | Data source login username. Can be used as optional ds_user parameter in queries. |
data > * > display_name | string | Display name for login |
data > * > cache_time | string | ISO 8601 datetime for the last time the login data was fetched and cached. Defaults to null when no cache was used. |
data > * > segments > * > segment_id | string | Segment ID |
data > * > segments > * > segment_id | string | Segment name |
HTTP 200 OK
{
"meta": {
"request_id": "CLg60nHFw2LCOmM7mMfgVgpuURpr00iY",
"query": {
"cache_minutes": null
}
},
"data": [
{
"ds_user": "35168435154",
"display_name": "info@supermetrics.com (ID: 35168435154)",
"cache_time": "2020-09-05T13:30:52+00:00",
"segments": [
{
"segment_id": "-1",
"segment_name": "All Users"
},
{
"segment_id": "-2",
"segment_name": "New Users"
},
{
"segment_id": "-3",
"segment_name": "Returning Users"
},
{
"segment_id": "-4",
"segment_name": "Paid Traffic"
},
{
"segment_id": "-5",
"segment_name": "Organic Traffic"
},
{
"segment_id": "-6",
"segment_name": "Search Traffic"
},
{
"segment_id": "-7",
"segment_name": "Direct Traffic"
}
]
}
]
}
Last updated 2022-06-22 UTC.