Solved

Exporting Metrics - Error when following example revenue API call

  • 8 December 2021
  • 5 replies
  • 203 views

Badge +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

icon

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

View original

5 replies

Userlevel 7
Badge +60

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 +2

Sure thing! Here it is:

 

Badge +2

@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!

Badge +1

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?

Badge +2

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

Anyone have any ideas?

Reply