const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '[{"mailing_list":1,"name":"Tobias First","address":"987 Main Street","address2":null,"city":"LENEXA","province":"KS","postal_code":"66216","country":"US","dob":"04/23/1981","custom1":null,"custom2":null,"email":"[email protected]","phone":"1234567890"},{"mailing_list":1,"name":"Tobias Second","address":"654 Main Street","address2":null,"city":"LENEXA","province":"KS","postal_code":"66216","country":"US","dob":"04/23/1981","custom1":null,"custom2":null,"email":"[email protected]","phone":"1234567890"}]'
};
fetch('https://api.thanks.io/api/v2/recipients_multi', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
[
{
"province": "KS",
"city": "Lenexa",
"name": "Tobias First",
"company": null,
"dob": "04/23/1981",
"country": "US",
"address": "987 Main Street",
"address2": "",
"email": "[email protected]",
"phone": "1234567890",
"custom1": null,
"custom2": null,
"postal_code": "66216"
},
{
"province": "KS",
"city": "Lenexa",
"name": "Tobias Second",
"company": null,
"dob": "04/23/1981",
"country": "US",
"address": "654 Main Street",
"address2": "",
"email": "[email protected]",
"phone": "1234567890",
"custom1": null,
"custom2": null,
"postal_code": "66216"
}
]
Add multiple recipients at once
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '[{"mailing_list":1,"name":"Tobias First","address":"987 Main Street","address2":null,"city":"LENEXA","province":"KS","postal_code":"66216","country":"US","dob":"04/23/1981","custom1":null,"custom2":null,"email":"[email protected]","phone":"1234567890"},{"mailing_list":1,"name":"Tobias Second","address":"654 Main Street","address2":null,"city":"LENEXA","province":"KS","postal_code":"66216","country":"US","dob":"04/23/1981","custom1":null,"custom2":null,"email":"[email protected]","phone":"1234567890"}]'
};
fetch('https://api.thanks.io/api/v2/recipients_multi', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
[
{
"province": "KS",
"city": "Lenexa",
"name": "Tobias First",
"company": null,
"dob": "04/23/1981",
"country": "US",
"address": "987 Main Street",
"address2": "",
"email": "[email protected]",
"phone": "1234567890",
"custom1": null,
"custom2": null,
"postal_code": "66216"
},
{
"province": "KS",
"city": "Lenexa",
"name": "Tobias Second",
"company": null,
"dob": "04/23/1981",
"country": "US",
"address": "654 Main Street",
"address2": "",
"email": "[email protected]",
"phone": "1234567890",
"custom1": null,
"custom2": null,
"postal_code": "66216"
}
]
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
OK
The response is of type object
.
Was this page helpful?