Solved

"name" filter on get metrics not working

  • 10 February 2023
  • 3 replies
  • 141 views

Userlevel 1
Badge +2

I have many processes in place and working, including a filter of the profiles, so I understand how those work, but when I try to use the “name” filter on metrics, I get an error that “name is not an allowed filter” for metrics, even though I’m copy/pasting from the Klaviyo API examples.

/api/metrics/?filter=equals%28name%2C%22fubar%22%29

Yields (output is my modified error statement using detail direct from Klaviyo output):

Result is 0|Invalid input.|'name' is not an allowed filter for this resource.

 

Even when I hard-code a real example instead of trying to get an error response I get that message:

        <cfhttp method="get"

                charset="utf-8"

                url=https://a.klaviyo.com/api/metrics/?filter=equals%28name%2C%22Active%20on%20Site%22%29

                result="klaviyoData"

                resolveurl="yes">

            <cfhttpparam type="header" name="Authorization" value="Klaviyo-API-Key #ARGUMENTS.KlaviyoPrivateAPI#">

            <cfhttpparam type="header" name="revision" value="2023-01-24">

            <cfhttpparam type="header" name="Accept" value="application/json">

            <cfhttpparam type="header" name="Content-Type" value="application/json">

        </cfhttp>

        <cfset VAR kResult = deserializejson(klaviyoData.filecontent) />

        <cfif isDefined("kResult.data")>

            <cfset myResult = kResult['data'][1]['id'] />

        <cfelseif isDefined("kResult.errors")>

            <cfset myResult = "0|#kResult['errors'][1]['title']#|#kResult['errors'][1]['detail']#" />

        </cfif>

 

What am I doing wrong?

icon

Best answer by Irrra 10 February 2023, 20:03

View original

3 replies

Userlevel 5
Badge +15

Hi @rlscsi !

This may be a bug of the klaviyo itself, contact technical support, they can solve or refer the issue to the klaviyo engineers.

Best, 
Iryna

Userlevel 1
Badge +2

Thanks - found out they don’t really have filters working for Metrics yet. Best method is to get all metrics and loop through them to find the one you want.

Userlevel 5
Badge +15

@rlscsi Have you already contacted technical support with this question?

Reply