GET Shared Segments from Analytics API 2.0 | Community
Skip to main content
Level 2
Jan 22, 2019 8:30 PM UTC
Solved

GET Shared Segments from Analytics API 2.0

Hi all!

I'm trying GET segments using the swagger UI, but I'm only returning segments with MY owner ID. There are segments that are shared with the entire organization and I need to get their IDs. Is there a way to see this via Swagger?

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Brian_Kent_Watson
Brian_Kent_WatsonAccepted solution
Employee
Feb 5, 2019 7:43 PM UTC

You can use the handy technique of "see how Workspace does it" to see how to format the segment GET request.  As an example, I turned on Developer Tools in my browser, then created a new Workspace project, and I can see the call to the segment service go across the wire like so:

Request URL: https://appservice5-10.omniture.com/analytics/1.0/segments/?locale=en_US&includeType=shared,templates,curatedItem&dataType=oberon&curatedRsid=geo1metrixxgeometrixx.outdoors&expansion=favorite,approved,tags,usageSummaryWithRelevancyScore,modified,internal,compatibility&toBeUsedInRsid=geo1metrixxgeometrixx.outdoors&limit=10000

Although you will be making calls through the Adobe IO gateway and not to the raw Workspace endpoints, the API request/response format is the same. So to get the list of segments Workspace displays in the left rail, which are the segments you own as well as those that are shared with you, you need to supply the "includeType" parameter and set its value to "shared". You can also supply the "templates" value to retrieve any segment templates. You likely won't have use for the "curatedItem" value but it includes any segments that were curated along with the report suite specified in the curatedRSID parameter.

6 replies

kshafer42Author
Level 2
Feb 5, 2019 10:23 PM UTC

This is amazing. You are amazing. I am amazed.

We'll give it a shot! Thanks a bunch!

Translate
Brian_Kent_Watson
Brian_Kent_WatsonAccepted solution
Employee
Feb 5, 2019 7:43 PM UTC

You can use the handy technique of "see how Workspace does it" to see how to format the segment GET request.  As an example, I turned on Developer Tools in my browser, then created a new Workspace project, and I can see the call to the segment service go across the wire like so:

Request URL: https://appservice5-10.omniture.com/analytics/1.0/segments/?locale=en_US&includeType=shared,templates,curatedItem&dataType=oberon&curatedRsid=geo1metrixxgeometrixx.outdoors&expansion=favorite,approved,tags,usageSummaryWithRelevancyScore,modified,internal,compatibility&toBeUsedInRsid=geo1metrixxgeometrixx.outdoors&limit=10000

Although you will be making calls through the Adobe IO gateway and not to the raw Workspace endpoints, the API request/response format is the same. So to get the list of segments Workspace displays in the left rail, which are the segments you own as well as those that are shared with you, you need to supply the "includeType" parameter and set its value to "shared". You can also supply the "templates" value to retrieve any segment templates. You likely won't have use for the "curatedItem" value but it includes any segments that were curated along with the report suite specified in the curatedRSID parameter.

Translate
kshafer42Author
Level 2
Jan 30, 2019 6:15 PM UTC
Gigazelle
Employee
Jan 30, 2019 6:00 PM UTC

Can you share the API call you're using? It might be defaulting to just your own segments.

Translate
kshafer42Author
Level 2
Jan 22, 2019 9:00 PM UTC

It appears it only works when I use the Tag filter. When I apply a tag to the shared segment, then GET with that tagName as the filter...I then see the shared segment in the Response Body.

Translate
kshafer42Author
Level 2
Jan 22, 2019 8:48 PM UTC

Side Note: I am also listed as an API admin.

Translate