POST /product
Requires authentication with server access token.
Create a new product, a subscription or a bundle. All of these are technically products, so which one you end up depends on the data you pass when creating it.
Subscriptions
To create a subscription, set the type
parameter to 2
. You must also specify the subscriptionPeriod
, which is required for subscriptions. Additionally, you may provide any or all of the optional parameters:
subscriptionRenewPrice
subscriptionRenewPeriod
subscriptionAutoRenew
subscriptionAutoRenewLockPeriod
subscriptionAutoRenewDisabled
subscriptionGracePeriod
subscriptionEmailReceiptLimit
subscriptionFinalEndDate
subscriptionSurveyUrl
The bundle
parameter may not be used with subscriptions.
Bundles
Set the bundle
parameter to 1
or 2
to make the product a bundle. When doing so, type
may not be set to subscription. When creating bundles, you may optionally provide the hideItems
parameter. When set to 1
, the bundle will be communicated as one product, and the individual products in the bundle will not be highlighted in any way.
Products
Most of the time, you want to set type
to 1
when creating plain products.
See also
GET
/productsGET
/product/{id}POST
/product/{id}POST
/bundle/{bundleId}/product/{productId}POST
/user/{userId}/subscription
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/product
code | requiredClient-defined product code. More easily recognizable than the numeric ID. Must be between 3 and 20 characters long. |
---|---|
name | requiredThe product name. Cannot be longer than 64 characters. |
price | requiredPrice, in cents |
vat | requiredVAT, fraction × 10000. For instance, 25% would be 2500 |
paymentOptions | required |
type | requiredThe product type |
currency | requiredThe price and VAT currency |
bundle | optionalIf the product is of type bundle, this field decides what bundle type. Bundle type 0: Not a bundle, 1: Dynamic bundle, 2: One-off bundle |
hideItems | optionalIf the product is a bundle, this field decides if the bundle items should be hidden ( |
status | optionalThe product status |
parentProductId | optionalID of the parent product, if any |
description | optionalProduct description. Must be between 3 and 255 characters long. |
url | optionalLink to the product. Must be between 3 and 1024 characters long. |
quantityLimit | optionalIf there is a limited supply for this product |
saleStart | optionalProvide if there is a sale of some sort |
saleStop | optionalProvide if there is a sale of some sort |
availableStart | optionalThe time from when the product is available for sale (date time) |
availableStop | optionalThe time when the product is no longer available for sale (date time) |
allowMultiSales | optional"1" if a user is allowed to purchase this product multiple times, "0" otherwise |
subscriptionPeriod | optionalThe duration of a subscription period, as a timestamp in seconds |
subscriptionRenewPrice | optionalPrice of subscription renewals, in cents |
subscriptionRenewPeriod | optionalThe duration of a renewal |
subscriptionAutoRenew | optional"1" if the subscription should automatically renew, "0" otherwise |
subscriptionAutoRenewLockPeriod | optionalThe duration of the initial period where auto renewal cannot be changed |
subscriptionAutoRenewDisabled | optional"1" if automatic renewals should not be available, "0" if they should |
subscriptionEmailReceiptLimit | optionalIf set to anything not null, will prevent emails from being sent on purchase/renewal of this subscription |
subscriptionFinalEndDate | optionalA date from when this product is no longer for sale |
subscriptionSurveyUrl | optionalURL to a survey for when people terminate a subscription for this product. |
filters | optional
|
Example request
curl
Minimal example
curl https://login.schibsted.com/api/2/product \
-X POST \
-H "Authorization: Bearer [access token]" \
-d "code=ipad" \
-d "name={"givenName":"John","familyName":"Doe","formatted":"John Doe"}" \
-d "price=400" \
-d "vat=96" \
-d "paymentOptions=2" \
-d "type=discount" \
-d "currency=NOK"
With all parameters
curl https://login.schibsted.com/api/2/product \
-X POST \
-H "Authorization: Bearer [access token]" \
-d "code=ipad" \
-d "name={"givenName":"John","familyName":"Doe","formatted":"John Doe"}" \
-d "price=400" \
-d "vat=96" \
-d "paymentOptions=2" \
-d "type=discount" \
-d "currency=NOK" \
-d "bundle=2" \
-d "hideItems=1" \
-d "status=0" \
-d "parentProductId=44" \
-d "description=Some information" \
-d "url=http://example.com" \
-d "quantityLimit=10" \
-d "saleStart=2016-06-01" \
-d "saleStop=2014-07-01" \
-d "availableStart=2014-01-01" \
-d "availableStop=2016-06-01" \
-d "allowMultiSales=1" \
-d "subscriptionPeriod=12000" \
-d "subscriptionRenewPrice=59" \
-d "subscriptionRenewPeriod=12000" \
-d "subscriptionAutoRenew=1" \
-d "subscriptionAutoRenewLockPeriod=12000" \
-d "subscriptionAutoRenewDisabled=1" \
-d "subscriptionEmailReceiptLimit=0" \
-d "subscriptionFinalEndDate=2014-12-31" \
-d "subscriptionSurveyUrl=http://survey.example.com"
Response
This endpoint supports the JSON and JSON-P response formats.
Success: 201 Created
Returns the newly created product
Product
productId ✓ | integer (as string)Unique product ID |
---|---|
parentProductId | integer (as string)ID of the parent product, if any |
clientId ✓ | stringYour client ID |
type ✓ | Product type |
bundle ✓ | Bundle type |
code ✓ | string |
name ✓ | stringProduct display name |
description ✓ | stringA detailed description of the product |
url | URL (string) |
price ✓ | price |
vat ✓ | integer (as string)VAT, fraction × 10000. For instance, 25% would be 2500 |
currency ✓ | stringPrice and VAT currency |
paymentOptions ✓ | Payment optionsAvailable payment options for this product |
quantityLimit | integer (as string)Maximum available sales for this product. |
quantityCount ✓ | integer (as string)Number of sales for this product so far |
saleStart ✓ | datetimeStart of a sale for this product (i.e. reduced price or with additional benefits) |
saleStop ✓ | datetimeEnd of a sale |
availableStart | datetimeWhen this product is available for purchase |
availableStop | datetimeWhen this product is no longer available for purchase |
subscriptionPeriod ✓ | timestamp, in secondsThe subscription period |
subscriptionRenewPrice ✓ | pricePrice of subscription renewal |
subscriptionRenewPeriod ✓ | timestamp, in secondsFor how long a renewal is valid |
subscriptionAutoRenew ✓ | string, "1" (true) or "0" (false)If |
subscriptionAutoRenewLockPeriod ✓ | timestamp, in secondsThe initial period during which auto renew cannot be changed |
subscriptionAutoRenewDisabled ✓ | string, "1" (true) or "0" (false)If |
subscriptionGracePeriod ✓ | integer (as string)The period after a failed renewal charge the subscription will stay active |
subscriptionEmailReceiptLimit ✓ | integer (as string)The maximum number of email receipts |
subscriptionFinalEndDate | datetimeBy this date, the subscription is no longer for sale |
allowMultiSales ✓ | string, "1" (true) or "0" (false)If |
status ✓ | Product status |
changedBy | integer (as string)ID of the user that made the last change |
changed | datetime |
createdBy ✓ | integer (as string)ID of the user that created this product |
created ✓ | datetime |
purchaseUri ✓ | URL (string)A URI where the product may be purchased |
The check mark ✓ indicates that the field always contains a valid non-empty value.
Product status
An enum, with the following possible values:
| Deleted |
---|---|
| Not available |
| Available, but not visible |
| Available, but not selectable |
| Available |
Payment options
Payment options can be provided as a bit mask.
Bitmask format is the default format. If payment options are not provided, the default value is 2 (bank card with PayEx).
Examples: 2
means credit card, 4
means SMS, while 6
means both credit card and SMS.
An enum, with the following possible values:
| Masterpass |
---|---|
| Credit card |
| SMS |
| PayEx Invoice |
| Voucher |
| Klarna Invoice |
| Klarna Mobile |
| Wallet |
Bundle type
An enum, with the following possible values:
| Not a bundle |
---|---|
| Dynamic bundle |
| Onetime bundle |
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 Missing one or more required parameters
- 400 Bad Request Failed to create or update product
- 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 Schibsted account 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
{
"subscriptionSurveyUrl": null,
"status": "1",
"purchaseUri": "https://identity-pre.schibsted.com/auth/start?client_id\u003d52f8e3d9efd04bb749000000\u0026flow\u003dpayment\u0026product_id\u003d301696",
"changedBy": null,
"subscriptionAutoRenewLockPeriod": "0",
"vat": "2500",
"clientId": "[Your client ID]",
"guardian": "0",
"currency": "NOK",
"subscriptionFinalEndDate": null,
"quantityCount": "0",
"createdBy": "[ID of admin user, or client]",
"name": "VG+",
"parentProductId": "301696",
"changed": "2014-08-05 11:59:05",
"saleStart": null,
"subscriptionGracePeriod": "0",
"subscriptionPeriod": "2592000",
"availableStop": null,
"subscriptionAutoRenew": "0",
"productId": "301696",
"code": "vg+",
"saleStop": null,
"bundle": "0",
"url": null,
"subscriptionEmailReceiptLimit": null,
"created": "2014-08-05 11:59:05",
"subscriptionRenewPeriod": null,
"type": "2",
"subscriptionAutoRenewDisabled": "0",
"subscriptionRenewPrice": null,
"hideItems": "0",
"paymentOptions": "2",
"price": "9900",
"allowMultiSales": "0",
"description": null,
"quantityLimit": null,
"autopay": "0",
"availableStart": null
}
JSON-P
callback({
"subscriptionSurveyUrl": null,
"status": "1",
"purchaseUri": "https://identity-pre.schibsted.com/auth/start?client_id\u003d52f8e3d9efd04bb749000000\u0026flow\u003dpayment\u0026product_id\u003d301696",
"changedBy": null,
"subscriptionAutoRenewLockPeriod": "0",
"vat": "2500",
"clientId": "[Your client ID]",
"guardian": "0",
"currency": "NOK",
"subscriptionFinalEndDate": null,
"quantityCount": "0",
"createdBy": "[ID of admin user, or client]",
"name": "VG+",
"parentProductId": "301696",
"changed": "2014-08-05 11:59:05",
"saleStart": null,
"subscriptionGracePeriod": "0",
"subscriptionPeriod": "2592000",
"availableStop": null,
"subscriptionAutoRenew": "0",
"productId": "301696",
"code": "vg+",
"saleStop": null,
"bundle": "0",
"url": null,
"subscriptionEmailReceiptLimit": null,
"created": "2014-08-05 11:59:05",
"subscriptionRenewPeriod": null,
"type": "2",
"subscriptionAutoRenewDisabled": "0",
"subscriptionRenewPrice": null,
"hideItems": "0",
"paymentOptions": "2",
"price": "9900",
"allowMultiSales": "0",
"description": null,
"quantityLimit": null,
"autopay": "0",
"availableStart": 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. Our team reads and responds to every question. Additionally, your experience can help others using Schibsted account, and it can help us continuously improve our documentation.