Cart lines
Cart lines are the products that are in the cart.
Modifier
Add product
Add a product to the cart of the logged in user. The cart itself is created if not already done.
Example
https://wsmedia.tlsecure.com/api/json/00000/cart/9789462500877
Modifier
Request
HTTP Verb : POST
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
token | Header | String(26) | v | ||
ean | Path | Long | v | ||
quantity | Form | Integer | 1 | ||
giftwrap | Form | Integer | |||
discount | Form | Float | % | ||
priceWithDiscount | Form | Float | |||
giftwrap | Form | Integer |
The giftwrap parameter allows you to insert a product in the cart directly with a giftwrap set.
The discount and priceWithDiscount parameters allow you to set up a discount if it can be applied (it must have been configured so). You may specify the discount itself (in %), or the calculated price. If both are given, the price will have the priority.
It is possible to automatically give the maximal reduction when adding a product without having to specify any parameters. You have to ask us for that functionality. If it works so, giving discount or priceWithDiscount parameters will override the automatic discount.
In the situation of a later call to that webservice, if no discounts parameters are submitted, it will result in a reset of that values with the default.
Modifier
Response
Success
{ "response": { "success": true "message": "cart line added" "object": { "cart": { "customer": 586 "productsQuantity": 1 "price": 22.5 "totalPrice": 22.5 "creationDate": "2016-03-02 14:56:58" "lines": { "line": [1] 0: { "ean": 9789462500877 "title": "Kip" "author": "Marcus Bean & Ellen Hosmar" "price": 22.5 "quantity": 1 "productForm": "BB" } } } } } }
Error
{ "response": { "success": false "code": 11 "message": "article not exist" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | cart line added |
1 | domaincode malformed | |
2 | connexion error | |
3 | token empty | |
4 | no token with that key | |
5 | invalid token | |
9 | {param} not {type} {(or undefined)} | |
11 | article not exist | |
12 | giftwrap not exist | |
13 | no postal charges available | |
99 | uncatched exception |
Modifier
Update product
Update the product quantity for a product line in the cart.
Updating the quantity to 0 remove the product as Delete product would do
Example
https://wsmedia.tlsecure.com/api/json/00000/cart/9789462500877
Modifier
Request
HTTP Verb : PUT
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
token | Header | String(26) | v | ||
Content-Type | Header | String | v | application/x-www-form-urlencoded | |
ean | Path | Long | v | ||
quantity | Form | Integer | v | ||
giftwrap | Form | Integer | |||
message(in test) | Form | String(255) |
The giftwrap parameter doens't change the giftwrap for a product (see giftwrap instead), he just select if the product to update has a giftwrap an which one. By default, if undefined, it update a line without giftwrap if it exists.
Modifier
Response
Success
{ "response": { "success": true "code": 0 "message": "cart line updated" "object": { "cart": { "customer": 2 "productsQuantity": 1 "price": 45 "totalPrice": 45 "creationDate": "2016-02-29 15:18:34" "orderlines": { "line": [1] 0: { "id": 1 "ean": 9789462500877 "title": "Kip" "author": "Marcus Bean & Ellen Hosmar" "price": 22.5 "quantity": 2 "productForm": "BB" "message": "test message" } } } } } }
Error
{ "response": { "success": false "code": 10 "message": "cart not exist" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | cart line updated |
1 | domaincode malformed | |
2 | connexion error | |
3 | token empty | |
4 | no token with that key | |
5 | invalid token | |
9 | {param} not {type} {(or undefined)} | |
10 | cart not exist | |
11 | article not exist | |
12 | giftwrap not exist | |
13 | no postal charges available | |
99 | uncatched exception |
Modifier
Remove product
Remove a product line from te cart.
Example
https://wsmedia.tlsecure.com/api/json/00000/cart/9789462910607
Modifier
Request
HTTP Verb : DELETE
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
token | Header | String(26) | v | ||
ean | Path | Long | v | ||
giftwrap | Query | Integer |
The giftwrap parameter remove the giftwrap for a product (see giftwrap instead), he just select if the product to remove has a giftwrap an which one. By default, if undefined, it deletes the line without giftwrap if it exists.
Modifier
Response
Success
{ "response": { "success": true "code": 0 "message": "cart line removed" "object": { "cart": { "customer": "2" "creationDate": "2016-02-29 15:18:34" } } } }
Error
{ "response": { "success": false "code": 11 "message": "article not exist" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | cart line removed |
1 | domaincode malformed | |
2 | connexion error | |
3 | token empty | |
4 | no token with that key | |
5 | invalid token | |
9 | {param} not {type} {(or undefined)} | |
10 | cart not exist | |
11 | article not exist | |
12 | giftwrap not exist | |
13 | no postal charges available | |
99 | uncatched exception |