Skip to main content
Solved

Getting error when passing body object - klaviyo-api-ruby


Forum|alt.badge.img+1

I'm getting this error:

Response body: {"errors":[{"id":"51c07451-b09a-4e77-a460-13cd0b920a28","status":400,"code":"invalid","title":"Invalid input.","detail":"The payload provided in the request is invalid.","source":{"pointer":"/data"},"meta":{}}]}

 

When trying to call:

@event = KlaviyoAPI::Events.create_event(body)

My body object looks like this:

body = {
    data: {
        type: 'event',
        attributes: {
            properties: {
                registryID: @registry.id,
                registryKind: @registry.kind
            },
            time: DateTime.now.new_offset(0).iso8601,
            value: 0,
            metric: {
                data: {
                    type: 'metric',
                    attributes: {
                        name: "Created Registry"
                    }
                }
            },
            profile: @profile
        }
    }
}

Any idea what the issue is with my body structure?
 

Best answer by gadabout

My issue is resolved, see here: https://github.com/klaviyo/klaviyo-api-ruby/issues/15

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

2 replies

Forum|alt.badge.img+1
  • Author
  • Contributor I
  • 2 replies
  • Answer
  • October 13, 2023

Brian Turcotte
Forum|alt.badge.img+37

Hi @gadabout!

Glad to hear the issue was resolved! Thank you for sharing your solution with the Community!
 

- Brian