Retrieve All Segments using API | Adobe Higher Education
Skip to main content
ryzen_
Level 2
July 12, 2023
Respondido

Retrieve All Segments using API

  • July 12, 2023
  • 4 respostas
  • 1579 Visualizações

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)

 

Este tópico foi fechado para respostas.
Melhor resposta por 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 

4 Respostas

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
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_Autor
Level 2
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
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
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 🙂