Get products
/products
Target audience: Developers
Get products¶
Introduction¶
Returns a list of products for an organisation
URI¶
Environment | URI |
---|---|
Stage | https://payway-api.stage.adeprimo.se/external/api/v1/products |
Production | https://backend.worldoftulo.com/external/api/v1/products |
Requirements¶
Identity | Scope |
---|---|
No | /external/product/r |
Parameters¶
Name | Type | Description |
---|---|---|
id | String | Id of a product. Cannot be used together with product_code. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
product_code | String | The product code for a package/campaign. Cannot be used together with id. Size range: 1..50 Allowed values: "/^[a-zA-Z-_0-9]+$/" |
product_type | String | Retrieve product of a certain type Allowed values: packages, campaigns, products |
title_code | String | Retrieve only products for a specific title. Size range: 1..15 Allowed values: "/^[a-zA-Z-_0-9]+$/" |
tags | String | Retrieve only product for specific tags (case sensitive). Size range: 1..100 Allowed values: "/^([a-zA-Z0-9]+,?\s*)+$/" |
include_inactive | Boolean | Includes inactive products it true |
Curl Example¶
Get by id¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/products?id=52a781d6400e06897c00000f \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Get by product_code¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/products?product_code=adeprimo_digital \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Specific type¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/products?product_type=campaigns \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Specific title-code¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/products?title_code=ADEPRIMO \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Specific title¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/products?product_type=campaigns&title_code=ADEPRIMO \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Get by tags¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/products?tags=analog,digital \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Response¶
Successful response for products without complex price model¶
HTTP 200
{
"items": [
{
"id": "56e1741a6fc9365306000002",
"created": "2013-12-10T22:04:22+01:00",
"updated": "2013-12-11T22:04:22+01:00",
"product_code": "adeprimo_digital",
"integration_code" : "external product code if set",
"valid_from": "2013-12-10T22:04:22+01:00",
"valid_to": "2014-01-10T22:04:22+01:00",
"is_package": true,
"is_campaign": false,
"parent_product_id": null, // If is_campaign == true this points to the package the campaign is based on
"parent_product_code": null, // If is_campaign == true this points to the package the campaign is based on
"title_code": "ADEPRIMO",
"name": "Adeprimo digital",
"description": "Adeprimo digital provides you with digital content",
"vat_code": "25",
"customer_can_cancel": false,
"products": [
{
"id": "580e10842762a843cf000005",
"product_code": "adeprimo_webb",
"name": "Adeprimo the website",
"description": "The complete Adeprimo website"
},
{
"id": "50ee9325400e06f15f0001b1",
"product_code": "adeprimo_epaper",
"name": "Adeprimo the website as Emagin epaper",
"description": "The complete Adeprimo website as Emagin epaper"
}
],
"price_periods": [
{
"id": "5cb804811d41c82b5c518ea8",
"purchase_type": "recurring",
"payment_option": "creditcard",
"type": "month",
"length": 1,
"price": 33.0
},
{
"id": "5cb8055c1d41c831096033ad",
"purchase_type": "limited",
"payment_option": "creditcard",
"type": "month",
"length": 3,
"price": 90.0
}
],
"tags": [
{
"name": "Analog",
"type": "package"
},
{
"name": "Digital",
"type": "package"
}
]
}
]
}
Successful response for products with complex price model¶
HTTP 200
{
"items": [
{
"id": "56e1741a6fc9365306000002",
"created": "2013-12-10T22:04:22+01:00",
"updated": "2013-12-11T22:04:22+01:00",
"product_code": "adeprimo_digital",
"integration_code" : "external product code if set",
"valid_from": "2013-12-10T22:04:22+01:00",
"valid_to": "2014-01-10T22:04:22+01:00",
"is_package": true,
"is_campaign": false,
"parent_product_id": null, // If is_campaign == true this points to the package the campaign is based on
"parent_product_code": null, // If is_campaign == true this points to the package the campaign is based on
"title_code": "ADEPRIMO",
"name": "Adeprimo digital",
"customer_can_cancel": true,
"description": "Adeprimo digital provides you with digital content",
"products": [
{
"id": "580e10842762a843cf000005",
"product_code": "adeprimo_webb",
"name": "Adeprimo the website",
"description": "The complete Adeprimo website"
},
{
"id": "50ee9325400e06f15f0001b1",
"product_code": "adeprimo_epaper",
"name": "Adeprimo the website as Emagin e-paper",
"description": "The complete Adeprimo website as Emagin e-paper"
}
],
"price_periods": [
{
"id": "5cb8055c1d41c831096033ad",
"purchase_type": "recurring",
"payment_option": "creditcard",
"type": "month",
"length": 1,
"details": [
{
"name": "Paper",
"price": 40.0
"vat_code": 6
},
{
"name": "Digital",
"price": 10.0
"vat_code": 25
},
]
}
],
"tags": [
{
"name": "Analog",
"type": "package"
},
{
"name": "Digital",
"type": "package"
}
]
}
]
}
Errors¶
Example error response¶
HTTP 400 Bad Request
{
"code": "invalid_parameter",
"field": "account_id",
"message": "Parameter must match format (/^[a-f\d]{24}$/)"
}
HTTP 400 Bad Request¶
Name | Type | Description |
---|---|---|
invalid_parameter | Object | Validation error on any of the fields in the posted json |
unknown_parameter | Object | One or more of the fields in the posted json was not recognized |
HTTP 404 Not Found¶
Name | Type | Description |
---|---|---|
not_found | Object | The product could not be found |
HTTP 500 Internal Server Error¶
Name | Type | Description |
---|---|---|
internal_server_error | Object | Something unexpected happened server side |