const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"title":"New Sub Account 22","return_name":"Your Business","return_address":"123 Main Street","return_address2":"Apartment 1","return_city":"Fake City","return_state":"NY","return_postal_code":"55555"}'
};
fetch('https://api.thanks.io/api/v2/sub-accounts', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"user_id": 2,
"title": "New Sub Account 2",
"return_name": "Your Business",
"return_address": "123 Main Street",
"return_address2": "Apartment 1",
"return_city": "Fake City",
"return_state": "NY",
"return_postal_code": "55555",
"updated_at": "2020-03-31 02:17:53",
"created_at": "2020-03-31 02:17:53",
"id": 9
}
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"title":"New Sub Account 22","return_name":"Your Business","return_address":"123 Main Street","return_address2":"Apartment 1","return_city":"Fake City","return_state":"NY","return_postal_code":"55555"}'
};
fetch('https://api.thanks.io/api/v2/sub-accounts', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"user_id": 2,
"title": "New Sub Account 2",
"return_name": "Your Business",
"return_address": "123 Main Street",
"return_address2": "Apartment 1",
"return_city": "Fake City",
"return_state": "NY",
"return_postal_code": "55555",
"updated_at": "2020-03-31 02:17:53",
"created_at": "2020-03-31 02:17:53",
"id": 9
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
OK
The response is of type object
.