Best answer

Using cURL or change format to send API request?

  • 12 December 2020
  • 5 replies
  • 4266 views

I’m struggling to send this /POST request using Zapier Webhooks.  The sample cURL request is below:

 

curl -X POST https://api.APIURL.com/v1/businesses \
  -u mk_live_213123123123123123: \
  -H "Accept: application/json" \
  -d name=COMPANYNAME \
  -d external_id=12345678 \
  -d tin\[tin\]=123410000 \
  -d website\[url\]=https://www.COMPANY.com \
  -d addresses\[0\]\[address_line1\]=577+XXXXXX \
  -d addresses\[0\]\[address_line2\]=Suite+400 \
  -d addresses\[0\]\[city\]=san+francisco \
  -d addresses\[0\]\[state\]=CA \
  -d addresses\[0\]\[postal_code\]=94105 \
  -d people\[0\]\[name\]=Kyle+XXX \
  -d phone_numbers\[0\]\[phone_number\]=650797XXXX

 

I’ve tried to send as a “form” but am not sure how to handle the arrays for “addresses” and “people”.  So, then I turned to a “Custom Request” with JSON but kept getting the following error:

 

 

Not sure why it’s saying ‘name’ is missing because...yeah.  Anyway, if anyone can see what silly mistake I am making it would be much appreciated! 

icon

Best answer by Troy Tessalone 12 December 2020, 03:18

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 7
Badge +14

Did you set the Custom Request to Method to POST?

 

Userlevel 7
Badge +14

OR try removing the the outer bracket because that’s what this field is doing

{ “data” : }

 

 

 

Alright! Removing the outer bracket got me past the:  “The app returned "Parameter `name` is missing".

but now there is an issue with the ‘address’ parameter:

 

Userlevel 7
Badge +14

This JSON worked for me:

{
"name":"Middesk+Inc",
"tin":
{
"tin":"123410000"
},
"website":
{
"url":"https://www.middesk.com"
},
"addresses":[
{
"address_line1":"577+Howard+St",
"address_line2":"Suite+400",
"city":"San+Francisco",
"state":"CA",
"postal_code":"94105"
}
]
}

 

Awesome - thank you! I owe ya a beer.