Skip to main content
Solved

Exporting Metrics - Error when following example revenue API call

  • December 8, 2021
  • 5 replies
  • 216 views

Forum|alt.badge.img+2

Hello,

 

I am trying to use Postman to make an API call to get the revenue generated by a specific campaign. Per this doc, I am making a GET request to the following endpoint: 

https://a.klaviyo.com/api/v1/metric/PLACEDORDERMETRIC/export

 

In my Klaviyo account, I have navigated to a URL that looks like this:

https://www.klaviyo.com/metric/KDbUXb/feed/placed-order#dimension=$attributed_message&value=YeniMY

 

So in the endpoint URL I have replaced PLACEDORDERMETRIC with KDbUXb

 

For params I am following the exact suggestion of the doc:

api_key=API_KEY (I have replaced API_KEY with my API key)

unit=’week’

measurement=’value’

where='[["$attributed_message","=",'YeniMY']]'

 

But it seems I am getting two errors, here is the response:

{
    "status": 400,
    "message": "* unit\n  * Select a valid choice. 'week' is not one of the available choices.\n* __all__\n  * Invalid where clause."
}

 

Any ideas what I am doing wrong?

 

Thanks,
Zach

Best answer by stephen.trumble

Hey @anonymous_wombat 

Would you mind sharing the full API request with your API key redacted, so i can review the entire call you are making. Most likely there is just a syntax error somewhere. We won’t know until I can see the full request you are making. Thank you!

View original
Did this topic or the replies in the thread help you find an answer to your question?

5 replies

stephen.trumble
Community Manager
Forum|alt.badge.img+60
  • Community Manager
  • 1518 replies
  • Answer
  • December 8, 2021

Hey @anonymous_wombat 

Would you mind sharing the full API request with your API key redacted, so i can review the entire call you are making. Most likely there is just a syntax error somewhere. We won’t know until I can see the full request you are making. Thank you!


Forum|alt.badge.img+2

Sure thing! Here it is:

 


Forum|alt.badge.img+2
  • Contributor II
  • 4 replies
  • February 10, 2022

@stephen.trumble @anonymous_wombat Did you figure this issue out? I am making a similar call but have an “Invalid where clause” that is identical to yours. Thanks!


Forum|alt.badge.img+1
  • Contributor I
  • 1 reply
  • February 24, 2022

I was getting a 404 Resource not found error as well when hitting the export endpoint.Any updates on this. Is there an alternative way to get revenue by utm_source via API  for the Shopify Placed Order Metric?


Forum|alt.badge.img+2

Unfortunately I haven’t figured this out, but would really like to!

Anyone have any ideas?