Skip to main content
Contributor III
December 31, 2022
Solved

How to issue POST requests with Node SDK/API

  • December 31, 2022
  • 1 reply
  • 118 views

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!

    This topic has been closed for replies.
    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

     

    1 reply

    Brian Turcotte
    Klaviyo Alum
    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