Solved

Correct Syntax For curl In Windows

  • 13 June 2022
  • 2 replies
  • 115 views

Badge +1

Hello Community.

I’m trying to use curl in Windows to add to a list.

So far I have this working in a bat file.

For windows I worked out that the url needs to be in double quotes and the double quotes in the data need to be escaped with a back slash.

d:\powerbas\Epos\curl.exe -o d:\powerbas\Epos\curl_test.txt -H "Content-Type: application/json" -X POST "https://a.klaviyo.com/api/v2/list/TcrZhw/members?api_key=pk_xxx" -d " { \"profiles\": [ { \"email\": \"antonisklaviyo+test@gmail.com\" } ] } "

I want to include the title, first, last name, Organization and phone number. I tried to start with the organisation like this.

d:\powerbas\Epos\curl.exe -o d:\powerbas\Epos\curl_test.txt -H "Content-Type: application/json" -X POST "https://a.klaviyo.com/api/v2/list/TcrZhw/members?api_key=pk_xxxx" -d " { \"profiles\": [ { \"email\": \"antonisklaviyo+test@gmail.com\" } , { \"organization\": \"klaviyo\" }] } "

Returns the following message

{"detail":"email or phone number is a required field for each profile"}

 

icon

Best answer by alex.hong 13 June 2022, 23:21

View original

2 replies

Userlevel 7
Badge +58

Hi there @djsuperstore,
 

Thanks for sharing with the Community. The first thing I would try when receiving that error is to adjust your call to this format:

{
"profiles": [
{
"email": "test@klaviyo.com",
"phone_number": "+12340000000",
"$first_name": "First",
"$last_name": "Last",
"$organization": "Org"
}
]
}

I also noticed that someone on the support team is in contact with you so I would check your emails for additional info from them.

 

Thank you,

Alex 

Badge +1

Thanks Alex, Was quite an easy one.

Reply