Search…
API Reference
Resources
Create an external tax calculator
How to create an external tax calculator via API
To create a new external tax calculator, send a POST request to the /api/external_tax_calculators endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/external_tax_calculators

Arguments

Body Parameter
Type
Required
type
string
Required
attributes.name
string
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
attributes.tax_calculator_url
string
Required
relationships.tax_categories
array
Optional

Example

Request
Response
The following request creates a new external tax calculator:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/external_tax_calculators' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "external_tax_calculators",
9
"attributes": {
10
"name": "Personal tax calculator",
11
"tax_calculator_url": "https://external_calculator.yourbrand.com"
12
}
13
}
14
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "external_tax_calculators",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde"
7
},
8
"attributes": {
9
"name": "Personal tax calculator",
10
"created_at": "2018-01-01T12:00:00.000Z",
11
"updated_at": "2018-01-01T12:00:00.000Z",
12
"reference": "ANY-EXTERNAL-REFEFERNCE",
13
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
14
"metadata": {
15
"foo": "bar"
16
},
17
"tax_calculator_url": "https://external_calculator.yourbrand.com"
18
},
19
"relationships": {
20
"tax_categories": {
21
"links": {
22
"self": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde/relationships/tax_categories",
23
"related": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde/tax_categories"
24
}
25
},
26
"markets": {
27
"links": {
28
"self": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde/relationships/markets",
29
"related": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde/markets"
30
}
31
},
32
"attachments": {
33
"links": {
34
"self": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde/relationships/attachments",
35
"related": "https://yourdomain.commercelayer.io/api/external_tax_calculators/xYZkjABcde/attachments"
36
}
37
}
38
},
39
"meta": {
40
"mode": "test"
41
}
42
}
43
}
Copied!
Last modified 23d ago
Copy link