API reference
Create a bundle
How to create a bundle via API
To create a new bundle, send a POST request to the /api/bundles endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body Parameter
Type
Required
type
string
Required
attributes.code
string
Required
attributes.name
string
Required
attributes.currency_code
string
Required, unless inherited by market
attributes.description
string
Optional
attributes.image_url
string
Optional
attributes.do_not_ship
boolean
Optional
attributes.do_not_track
boolean
Optional
attributes.price_amount_cents
integer
Required
attributes.compare_at_amount_cents
integer
Required
attributes._compute_price_amount
boolean, value is 'true'
Optional
attributes._compute_compare_at_amount
boolean, value is 'true'
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.market
object
Optional
relationships.sku_list
object
Required

Example

Request
Response
The following request creates a new bundle:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/bundles' \
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": "bundles",
9
"attributes": {
10
"code": "BUNDMM000000FFFFFFXLXX",
11
"name": "Black Men T-shirt (XL) with Black Cap and Socks, all with White Logo",
12
"currency_code": "EUR",
13
"price_amount_cents": 10000,
14
"compare_at_amount_cents": 13000
15
},
16
"relationships": {
17
"sku_list": {
18
"data": {
19
"type": "sku_lists",
20
"id": "QWERtyUpBa"
21
}
22
}
23
}
24
}
25
}'
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": "bundles",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde"
7
},
8
"attributes": {
9
"code": "BUNDMM000000FFFFFFXLXX",
10
"name": "Black Men T-shirt (XL) with Black Cap and Socks, all with White Logo",
11
"currency_code": "EUR",
12
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
13
"image_url": "https://img.yourdomain.com/bundles/xYZkjABcde.png",
14
"do_not_ship": false,
15
"do_not_track": false,
16
"price_amount_cents": 10000,
17
"price_amount_float": 100.0,
18
"formatted_price_amount": "€100,00",
19
"compare_at_amount_cents": 13000,
20
"compare_at_amount_float": 130.0,
21
"formatted_compare_at_amount": "€130,00",
22
"skus_count": 2,
23
"created_at": "2018-01-01T12:00:00.000Z",
24
"updated_at": "2018-01-01T12:00:00.000Z",
25
"reference": "ANY-EXTERNAL-REFEFERNCE",
26
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
27
"metadata": {
28
"foo": "bar"
29
}
30
},
31
"relationships": {
32
"market": {
33
"links": {
34
"self": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/relationships/market",
35
"related": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/market"
36
}
37
},
38
"sku_list": {
39
"links": {
40
"self": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/relationships/sku_list",
41
"related": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/sku_list"
42
}
43
},
44
"skus": {
45
"links": {
46
"self": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/relationships/skus",
47
"related": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/skus"
48
}
49
},
50
"attachments": {
51
"links": {
52
"self": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/relationships/attachments",
53
"related": "https://yourdomain.commercelayer.io/api/bundles/xYZkjABcde/attachments"
54
}
55
}
56
},
57
"meta": {
58
"mode": "test"
59
}
60
}
61
}
Copied!
Copy link