I’m a novice so hoping someone smarter than me can lend a helping hand here.
I’m testing out a custom app for Outreach.io. I’m hoping to build a simple action to POST a prospect.
I have successfully authenticated with my app and performed a test GET so all good there.
When trying to POST the prospect I think I need to reformat my request using code mode.
When I open code mode the default is populated very differently to what what is in the example POST on the Outreach API documentation.
"data": {
"type": "prospect",
"attributes": {
"firstName": "John"
}
V
const options = {
url: 'https://api.outreach.io/api/v2/prospects',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${bundle.authData.access_token}`
},
params: {
},
body: {
'firstName': bundle.inputData.firstName
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// You can do any parsing you need for results here before returning them
return results;
});
Do I need to fit my data into the body of the default Zapier code or what’s the direction here?