Skip to main content
Contributor I
October 12, 2023
Solved

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

  • October 12, 2023
  • 2 replies
  • 361 views

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?
 

    This topic has been closed for replies.
    Best answer by gadabout

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

    2 replies

    gadaboutAuthorAnswer
    Contributor I
    October 13, 2023
    Brian Turcotte
    Klaviyo Alum
    October 19, 2023

    Hi @gadabout!

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

    - Brian