Updating segment definition via Adobe Analytics API 2.0
Hi all,
Has anyone successfully updated the segment definition via the AA API 2.0? I can update the name, description and owner but not the definition.
I get an 400 response when trying the below JSON with "definition" added and a 200 response when removing "definition" and just having "container" : {...}. But the definition does not update.
Request:
PUT_URL = f'https://analytics.adobe.io/api/{GLOBAL_COMPANY_ID}/segments/{SEGMENTID}?locale=en_US&expansion=definition'
response = requests.put(url=PUT_URL, headers=HEADER, data=json.dumps(data))
Here's an example data JSON
definition_update = {
"name": "Test Segment",
"description": "Test Segment description",
"definition": {
"container": {
"context": "visitors",
"func": "container",
"pred": {
"func": "exists",
"val": {
"func": "attr",
"name": "variables/page"
}
}
},
"func": "segment",
"version": [1, 0, 0]
}
}
Error message with "definition" added:
Segment validation failed. HTTP 400 Bad Request - Segment validation failed, validation response was {\\"validator_version\\":\\"1.1.25\\",\\"message\\":[\\"Definition validation error\\"],\\"errors\\":[{\\"location\\":\\"version\\",\\"error\\":16,\\"message\\":\\"Unsupported Version: An unsupported version is given in the segment function...
I've already gone through these documentations but it doesn't actually show you an example of the data JSON passed into the PUT request to update a definition.
https://developer.adobe.com/analytics-apis/docs/2.0/guides/endpoints/segments/
https://adobedocs.github.io/analytics-2.0-apis/
https://github.com/AdobeDocs/analytics-2.0-apis/blob/master/segments-guide.md
Thank you,
Vernon



