Select Visitor agent field
I'm requesting Visitors data from the API, and trying to reduce redundancy in the response data by selecting fields I want. Specifically, I want certain fields that are normally nested within an "agent" object in the response data, fields like "language" or "email".
The definition I'm using:
{
"response": {
"mimeType": "application/json"
},
"request": {
"requestId": "visitor-list",
"pipeline": [
{
"source": {
"visitors": {
"identified": null
}
}
},
{
"select": {
"id": "visitorId"
}
}
]
}
}
What must I add to this definition to get fields from the "agent" metadata object?
Response I want:
{
"results": [{
"metadata": {
"agent": {
"email": "ac@Cras.co.uk",
"ipaddress": "184.169.45.4",
"language": "en_US"
},
"visitorId": "84"
}]
}
コメント
To accomplish that, you'd want to add the specific metadata fields or field groups you want to your
selectstatement. You would do this using dot notation to specify the values you want returned. For example, if you want to see all agent metadata, you could format thatselectlike this:By referencing
metadata.agent,it would pull that specific section from the original results and give you an output that looks like this (from my test account):But if you wanted to see only all email addresses (for example), you could be even more specific and use:
which would return:
サインインしてコメントを残してください。