Get shipping methods
This article will guide you through how to retrieve shipping methods. The Postman collection will be used for all examples.
Prerequisites
accessToken
from Connect flow.countryId
from Get countries.priceGroupId
either from your basket or from Get price groups.cultureCode
, e.g.en-US
Optional query parameters
maxItems
- limits the number of payment methods returned. The list is paginated.nextPagingToken
- required to fetch the next page. The token is described in detail in Next Paging Token article
Get shipping methods
Open the Get Shipping Methods
request.
Provide the mandatory query parameters - countryId
, priceGroupId
and cultureCode
. Optional query parameters can be added as well.
Request:
curl -D- -X GET {base_url}/api/v1/shipping-methods?cultureCode={cultureCode}&countryId={countryId}&priceGroupId={priceGroupId} \ -H 'Authorization: Bearer <ACCESS_TOKEN>' -H 'Content-Type: application/json' \
If you get a successful response, you will get a list of shippingMethods
and nextPagingToken
returned to you.
Response:
{ "pagingToken": null, "shippingMethods": [ { "description": "{description}", "displayName": "{displayName}", "id": "{id}", "imageUrl": "{imageUrl}", "name": "{name}", "price": { "amount": "{amount}", "currency": "{currency}" } }, { "description": "{description}", "displayName": "{displayName}", "id": "{id}", "imageUrl": "{imageUrl}", "name": "{name}", "price": { "amount": "{amount}", "currency": "{currency}" } }, { "description": "{description}", "displayName": "{displayName}", "id": "{id}", "imageUrl": "{imageUrl}", "name": "{name}", "price": { "amount": "{amount}", "currency": "{currency}" } } ] }`
Possible errors that may occur
Error | Description |
---|---|
BadRequest (400) | Shipping methods not found in the given context. No shipping methods found on the given price group or country. |
Unauthorized (401) | The token is expired. |
Forbidden (403) | Access token does not have access to current context. |
{ "errors": [ { "error-description": "Shipping methods not found on the given context", "error": "BadRequest" } ] }
See Handling failures for more info.