Accounts
Most data sources require the ds_accounts parameter for a query. You can define it either as a list of account IDs, or as an account filter.
List of accounts
Parameter should be a list of strings, referring to an account ID, or to a team list. This method of defining accounts gives you the best query performance.
Values can be passed either as a comma delimited string, or as a list of strings.
{"ds_accounts": "list.all_accounts"}
{"ds_accounts": "567890, 1358618"}
{"ds_accounts": ["567890", "1358618"]}
Supported values
Account IDs are normally the accounts you have access to, or in some data sources, user-defined values such as URLs or tags.
Team lists are pre-saved lists, containing multiple account ID values. We also provide some built-in lists. Values from a team list are placed into the query parameters as soon as the request is received.
Account filter
Parameter should be an object containing filter conditions to find accounts for the query. This option is suitable for when query accounts should change whenever the data source accounts change.
{"ds_accounts":{"filter_id":"^act_45.*"}}
Filtering is available to all data sources where ds_accounts is expected to an ID from accounts you have access to.
Property | Type | Description |
filter_id | string | Regular expression (PCRE) that should match the account ID, with or without enclosing delimiters. |
filter_name | string | Regular expression (PCRE) that should match the account name, with or without enclosing delimiters. |
Related settings
exclude_unavailable_accounts
Automatically remove accounts from query when they can't be found.exclude_inactive_accounts
Automatically remove account from query when account status is inactive. Behaviour and availability depends on the data source. Please check settings.exclude_invalid_accounts
Automatically remove account from query results when an error occurred while trying to access it. Behaviour and availability depends on the data source. Please check settings.
Examples
Example 1
Targeting all accounts with a built-in list.
{"ds_accounts":"list.all_accounts"}
Example 2
Matching to accounts where name begins with "Super", in a case-insensitive way.
{"ds_accounts":{"filter_name":"#^Super#i"}}
Example 3
Matching to accounts where ID begins with a number and name ends with "Metrics". Note the additional backlash in escape sequence due to JSON encoding.
{"ds_accounts":{"filter_id":"^\\d","filter_name":"Metrics$"}}
Limitations
Account filtering uses cached information about your accounts. You should not expect immediate effects when changes are made inside the data source provider service.
Selection and the amount of accounts you can include into your query can be restricted by your Supermetrics API license. Please contact us for detailed information.
Best practices
- To improve your query performance and stability, we recommend using the additional ds_user parameter whenever possible. This is important especially when using an account filter.