POST /bundle/{bundleId}/product/{productId}
Requires authentication with server access token.
Add a product to a bundle. Adding a product to a bundle creates a bundle item. Price, VAT and sorting order are properties of this object (i.e., not the product itself - the product is not affected in any way by this operation). If the product has already been added to the bundle, another POST
will update it.
See also
- Docs for the Bundle API
- The Bundle type object
POST
/productDELETE
/bundle/{bundleId}/product/{productId}
Help us improve
Did you spot an error? Or maybe you just have a suggestion for how we can improve? Leave us a comment.
Request
POST /api/2/bundle/{bundleId}/product/{productId}
bundleId | required path parameterID of the bundle |
---|---|
productId | required path parameterID of the product |
sort | optional |
price | optional |
vat | optional |
Example request
cURL
Minimal example
curl https://login.schibsted.com/api/2/bundle/42/product/1337 \
-X POST \
-d "oauth_token=[access token]"
With all parameters
curl https://login.schibsted.com/api/2/bundle/42/product/1337 \
-X POST \
-d "oauth_token=[access token]" \
-d "sort=userId" \
-d "price=400" \
-d "vat=96"
Java
Minimal example
SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
POST(token, "/bundle/42/product/1337").
getResponseBody();
With all parameters
Map<String, String> params = new HashMap<>() {{
put("sort", "userId");,
put("price", "400");,
put("vat", "96");
}};
SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
POST(token, "/bundle/42/product/1337", params).
getResponseBody();
This example is an excerpt, see a full example
PHP
Minimal example
<?php
$client->auth();
echo var_dump($client->api("/bundle/42/product/1337", "POST"));
With all parameters
<?php
$params = array(
"sort" => "userId",
"price" => "400",
"vat" => "96"
);
$client->auth();
echo var_dump($client->api("/bundle/42/product/1337", "POST", $params));
This example is an excerpt, see a full example
Clojure
Minimal example
(ns example
(:require [spid-client-clojure.core :as spid]))
(let [client (spid/create-client "[client-id]" "[secret]")
token (spid/create-server-token client)]
(spid/POST client token "/bundle/42/product/1337"))
With all parameters
(ns example
(:require [spid-client-clojure.core :as spid]))
(let [client (spid/create-client "[client-id]" "[secret]")
token (spid/create-server-token client)]
(spid/POST client token "/bundle/42/product/1337" {"sort" "userId"
"price" "400"
"vat" "96"}))
Response
This endpoint supports the JSON and JSON-P response formats.
Success: 200 OK
Returns the newly inserted bundle item
Bundle item
bundleItemId ✓ | stringUnique bundle item ID |
---|---|
bundleId ✓ | stringThe bundle's product ID |
productId ✓ | stringID of the product to add |
price ✓ | price |
vat ✓ | integer (as string)VAT, fraction × 10000. For instance, 25% would be 2500 |
sort ✓ | integer (as string)Sorting order, relative to other bundle items |
bundle | Bundle |
product | Product |
status | Bundle item status |
status_updated ✓ | datetimeWhen the bundle item status was last updated |
updated ✓ | datetimeWhen the bundle item was last updated |
created ✓ | datetimeWhen the bundle was created |
The check mark ✓ indicates that the field always contains a valid non-empty value.
Bundle item status
An enum, with the following possible values:
| Deleted |
---|---|
| Active |
Failure cases
Some HTTP response codes are used for multiple error situations. There is no consistent way to tell these apart, but the error object will contain a textual explanation of the reason for the error. For explanation on OAuth related failures and errors see OAuth authentication failures.
- 400 Bad Request Bundle id supplied does not exist or is not a bundle
- 400 Bad Request Product id supplied does not exist.
- 400 Bad Request Error when creating bundle item. Detailed error message enclosed.
- 401 Unauthorized You don't have administration rights for this client.
- 401 Unauthorized Your client doesn't have administration rights for this client.
- 403 Forbidden Client is not authorized to access this API endpoint. Contact SPiD to request access.
- 403 Forbidden Requesting IP is not whitelisted
- 403 Forbidden Access token rejected
- 404 Not Found Unknown client ID
- 404 Not Found Client ID mismatch. The client making the request is no the owner of this resource, and does not have administrative privileges for it.
- 420 Request Ratelimit exceeded
Sample response
JSON
{
"status": "1",
"vat": null,
"bundle_id": "301699",
"bundle_item_id": "37",
"product_id": "301697",
"status_updated": "2014-08-05 13:47:12",
"bundle": {
"status": "1",
"vat": "2284",
"subscription_renew_period": null,
"changed_by": null,
"subscription_auto_renew_disabled": "0",
"guardian": "0",
"currency": "NOK",
"allow_multi_sales": "0",
"sale_stop": null,
"subscription_auto_renew": "0",
"name": "VG+ Alle slag",
"subscription_grace_period": "0",
"created_by": "52f8e3d9efd04bb749000000",
"changed": "2014-08-05 13:41:24",
"client_id": "52f8e3d9efd04bb749000000",
"quantity_count": "0",
"payment_options": "2",
"product_id": "301699",
"subscription_survey_url": null,
"available_start": null,
"sale_start": null,
"code": "vg+bundle",
"hide_items": "0",
"subscription_email_receipt_limit": null,
"bundle": "1",
"url": null,
"created": "2014-08-05 13:41:24",
"type": "1",
"quantity_limit": null,
"subscription_final_end_date": null,
"available_stop": null,
"parent_product_id": "301699",
"price": "9516",
"subscription_period": null,
"subscription_auto_renew_lock_period": "0",
"subscription_renew_price": null,
"description": null,
"autopay": "0"
},
"product": {
"status": "1",
"vat": "2500",
"subscription_renew_period": null,
"changed_by": null,
"subscription_auto_renew_disabled": "0",
"guardian": "0",
"currency": "NOK",
"allow_multi_sales": "0",
"sale_stop": null,
"subscription_auto_renew": "0",
"name": "VG+ 3 måneder",
"subscription_grace_period": "0",
"created_by": "52f8e3d9efd04bb749000000",
"changed": "2014-08-05 13:04:17",
"client_id": "52f8e3d9efd04bb749000000",
"quantity_count": "0",
"payment_options": "2",
"product_id": "301697",
"subscription_survey_url": null,
"available_start": null,
"sale_start": null,
"code": "vg+3mo",
"hide_items": "0",
"subscription_email_receipt_limit": null,
"bundle": "0",
"url": null,
"created": "2014-08-05 13:04:17",
"type": "2",
"quantity_limit": null,
"subscription_final_end_date": null,
"available_stop": null,
"parent_product_id": "301696",
"price": "9900",
"subscription_period": "2592000",
"subscription_auto_renew_lock_period": "0",
"subscription_renew_price": null,
"description": null,
"autopay": "0"
},
"created": "2014-08-05 13:47:12",
"updated": "2014-08-05 13:47:12",
"sort": "0",
"price": null
}
JSON-P
callback({
"status": "1",
"vat": null,
"bundle_id": "301699",
"bundle_item_id": "37",
"product_id": "301697",
"status_updated": "2014-08-05 13:47:12",
"bundle": {
"status": "1",
"vat": "2284",
"subscription_renew_period": null,
"changed_by": null,
"subscription_auto_renew_disabled": "0",
"guardian": "0",
"currency": "NOK",
"allow_multi_sales": "0",
"sale_stop": null,
"subscription_auto_renew": "0",
"name": "VG+ Alle slag",
"subscription_grace_period": "0",
"created_by": "52f8e3d9efd04bb749000000",
"changed": "2014-08-05 13:41:24",
"client_id": "52f8e3d9efd04bb749000000",
"quantity_count": "0",
"payment_options": "2",
"product_id": "301699",
"subscription_survey_url": null,
"available_start": null,
"sale_start": null,
"code": "vg+bundle",
"hide_items": "0",
"subscription_email_receipt_limit": null,
"bundle": "1",
"url": null,
"created": "2014-08-05 13:41:24",
"type": "1",
"quantity_limit": null,
"subscription_final_end_date": null,
"available_stop": null,
"parent_product_id": "301699",
"price": "9516",
"subscription_period": null,
"subscription_auto_renew_lock_period": "0",
"subscription_renew_price": null,
"description": null,
"autopay": "0"
},
"product": {
"status": "1",
"vat": "2500",
"subscription_renew_period": null,
"changed_by": null,
"subscription_auto_renew_disabled": "0",
"guardian": "0",
"currency": "NOK",
"allow_multi_sales": "0",
"sale_stop": null,
"subscription_auto_renew": "0",
"name": "VG+ 3 måneder",
"subscription_grace_period": "0",
"created_by": "52f8e3d9efd04bb749000000",
"changed": "2014-08-05 13:04:17",
"client_id": "52f8e3d9efd04bb749000000",
"quantity_count": "0",
"payment_options": "2",
"product_id": "301697",
"subscription_survey_url": null,
"available_start": null,
"sale_start": null,
"code": "vg+3mo",
"hide_items": "0",
"subscription_email_receipt_limit": null,
"bundle": "0",
"url": null,
"created": "2014-08-05 13:04:17",
"type": "2",
"quantity_limit": null,
"subscription_final_end_date": null,
"available_stop": null,
"parent_product_id": "301696",
"price": "9900",
"subscription_period": "2592000",
"subscription_auto_renew_lock_period": "0",
"subscription_renew_price": null,
"description": null,
"autopay": "0"
},
"created": "2014-08-05 13:47:12",
"updated": "2014-08-05 13:47:12",
"sort": "0",
"price": null
});
Comments/feedback
Do you have questions, or just want to contribute some newly gained insight? Want to share an example? Please leave a comment. SPiD reads and responds to every question. Additionally, your experience can help others using SPiD, and it can help us continuously improve our documentation.