Solved

Exporting Metrics - Error when following example revenue API call

  • 8 December 2021
  • 2 replies
  • 39 views

Badge

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

icon

Best answer by stephen.trumble 8 December 2021, 21:42

View original

2 replies

Userlevel 5
Badge +29

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!

Badge

Sure thing! Here it is:

 

Reply