Retrieve All Segments using API | Community
Skip to main content
ryzen_
New Participant
July 12, 2023
Solved

Retrieve All Segments using API

  • July 12, 2023
  • 1 reply
  • 1517 views

Hello to everyone,

I cannot find a way to retrieve all segments using the Endpoint Segment API. The request returns only a few segments without any particular reason. 

 

For example, given two segments (from the same Report Suite, created by the same person (me) and containing the same dimensions) one is extracted and the other is not.

Can anyone help me with this? What other characteristic of the segment could affect the API response?

Thank you in advance!

 

This is the request:

headers = { 'Accept': 'application/json', 'Authorization': f'Bearer {access_token}', 'Content-Type': 'application/json', 'x-api-key': CLIENT_ID, 'x-proxy-global-company-id': global_company_id, } params_seg1 = { 'expansion':'reportSuiteName,ownerFullName,modified,tags,compatibility,definition,publishingStatus,definitionLastModified,categories' } url = f"https://analytics.adobe.io/api/{global_company_id}/segments" response = requests.get(url, params=params_seg1, headers=headers)

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

Have you tried using the API Swagger tool and documentation.. it looks like there is a way to pass a limit, you could increase that limit to something high enough to achieve your needs...  or make multiple calls to pull back group 1, then group 2, then group 3, etc by page

 

https://adobedocs.github.io/analytics-2.0-apis/#/Segments/segments_getSegments 

1 reply

Jennifer_Dungan
Jennifer_DunganAccepted solution
New Participant
July 12, 2023

Have you tried using the API Swagger tool and documentation.. it looks like there is a way to pass a limit, you could increase that limit to something high enough to achieve your needs...  or make multiple calls to pull back group 1, then group 2, then group 3, etc by page

 

https://adobedocs.github.io/analytics-2.0-apis/#/Segments/segments_getSegments 

ryzen_
ryzen_Author
New Participant
July 13, 2023

Thank you! I just needed to add "limit:400" to parameters of the API request and it pulled all the segments.

 

Have a good day!

Jennifer_Dungan
New Participant
July 13, 2023

Yay, glad you are sorted out.

 

Glad you have less than 400 segments.. if you had something like 2000, then you might have wanted to use the "page" option 🙂