Solved

Why is the List and Segment information not shown as an example in the API reference?

  • 23 March 2023
  • 2 replies
  • 82 views

Badge

Hello!
I’m using the ‘get profiles’ API ‘https://a.klaviyo.com/api/profiles/’ (v2023-02-22) and trying to get the lists and segments information which belong to each profile without making another API call.

As shown in the example on the API reference page(https://developers.klaviyo.com/en/reference/get_profiles), the list and segment information will be displayed below.

"relationships": {
"lists": {
"data": [
{
"type": "list",
"id": "string"
}
]
},
"segments": {
"data": [
{
"type": "segment",
"id": "string"
}
]
}
},


But when I called the ‘get profiles’ API, I received a link instead of detailed list and segment data as shown in the example.

"relationships": {
"lists": {
"links": {
"self": "https://a.klaviyo.com/api/profiles/01GW3TF35QXF3KCFBX970XYFHY/relationships/lists/",
"related": "https://a.klaviyo.com/api/profiles/01GW3TF35QXF3KCFBX970XYFHY/lists/"
}
},
"segments": {
"links": {
"self": "https://a.klaviyo.com/api/profiles/01GW3TF35QXF3KCFBX970XYFHY/relationships/segments/",
"related": "https://a.klaviyo.com/api/profiles/01GW3TF35QXF3KCFBX970XYFHY/segments/"
}
}
}


Please help to give me the way to get the list and segment information without another API call?

Thanks!

icon

Best answer by chloe.strange 23 March 2023, 17:12

View original

2 replies

Userlevel 5
Badge +28

Hi @NhaPham

Thank you for being a part of our community! And thank you for bringing this to our attention. I connected with the engineering team and confirmed that the documentation will need to be updated as it is consistent with the results, as you had highlighted. To answer your question about how to accomplish your goal - there is no way to fetch the data all at once. You will need to make additional requests to the linked resources.

The team designed the API that way because the linked resources behind each can be large and it’s better to make multiple, smaller API calls than to make one larger API call for both server and client. I hope this helps. Let me know if you have any other questions.

~Chloe

Badge

Thank you @chloe.strange for your reply and information!

Reply