Skip to main content
Solved

How to issue POST requests with Node SDK/API

  • December 31, 2022
  • 1 reply
  • 78 views

Forum|alt.badge.img+3
  • Contributor III
  • 5 replies

Hi folks,

I posted this on Github before I found this forum, but I’m having a basic issue getting started, which is probably just my not understanding the documentation.

I've set up my account and gotten my API key, but am failing to get a simple registration to succeed.

All the details are in the Github issue. I would have put them here as well, but the community forum issues a 403 error if I try and do that, so you’ll have to jump over to GitHub to see them.

Thanks for any help!

Best answer by Brian Turcotte

Hi @ChrisR and welcome to the Community!

 

I see that one of our engineers responded to your Github thread, but here’s the gist of what he wrote:

  • There is an object named data which is intended to hold all profile info
  • The request should look something like this:
    const body = {
        data: {
            type: "profile",
            attributes: {
                email: "test@klaviyo-demo.com"
            }
        }
    }
    
    const response = await Profiles.createProfile(body)
  • He’s planning to update the docs to make this more clear.

Thanks for using the Community!

- Brian

 

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

1 reply

Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • Answer
  • January 3, 2023

Hi @ChrisR and welcome to the Community!

 

I see that one of our engineers responded to your Github thread, but here’s the gist of what he wrote:

  • There is an object named data which is intended to hold all profile info
  • The request should look something like this:
    const body = {
        data: {
            type: "profile",
            attributes: {
                email: "test@klaviyo-demo.com"
            }
        }
    }
    
    const response = await Profiles.createProfile(body)
  • He’s planning to update the docs to make this more clear.

Thanks for using the Community!

- Brian