Solved

Odd dimension ID in /api/metric-aggregates/ response

  • 20 December 2023
  • 1 reply
  • 37 views

Badge +2

Hey Klaviyo team,

I’ve requested statistics for metric "Ordered Product" grouped by $attributed_message:

POST /api/metric-aggregates/ HTTP/1.1
Host: a.klaviyo.com
Authorization: Klaviyo-API-Key {{api_key}}
revision: 2023-10-15
Accept: application/json
Content-Type: application/json
Content-Length: 418

{
"data": {
"type": "metric-aggregate",
"attributes": {
"metric_id": "V5NtMc",
"interval": "month",
"measurements": [
"count"
],
"filter": [
"greater-or-equal(datetime,2023-10-01T00:00:00)",
"less-than(datetime,2023-11-01T00:00:00)"
],
"by": [
"$attributed_message"
],
"page_size": 500,
"timezone": "UTC"
}
}
}

In the response I see “long” and “short” IDs in "dimensions", for example:

                {
"dimensions": [
"01HDGWHBJRWC0VZZDTS611Q4WJ"
],
"measurements": {
"count": [
1.0
]
}
},
{
"dimensions": [
"QRmivv"
],
"measurements": {
"count": [
99.0
]
}
},

Using “long” ID, I’ve managed to retrieve properties of the campaign on which the event was attributed:

        "type": "campaign",
"id": "01HDGWHBJRWC0VZZDTS611Q4WJ",
"attributes": {
"name": "EMEA_DE_DL_BARBIE_Email_2023_251023_RET_MAT_World-of-Reveal_PK39_BAU",
"status": "Sent",
"archived": false,
...

But using “short” ID, I’ve got error 404 “Not Found”:

{
"errors": [
{
"id": "87e541fb-86a8-4952-9d68-f570e4d0c29b",
"status": 404,
"code": "not_found",
"title": "Not found.",
"detail": "A campaign with id 'QRmivv' does not exist.",
"source": {
"pointer": "/data/"
}
}
]
}

I’ve also checked - it’s not a flow or list.

Could you please clarify which ID I got here?

 

Thanks &regards,

Evgeniy

icon

Best answer by saulblum 20 December 2023, 18:03

View original

1 reply

Userlevel 4
Badge +7

Hi, generally an ID like QRmivv as an attribution will be a flow message, not the flow itself.

Go to https://www.klaviyo.com/email/flow/QRmivv/content and you’ll see which flow message is being referenced. You can also use the Get Flow Message API.

Reply