Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Getting shipping methods for your order

The first thing you need to do is to attach your accessToken to the request's header. See Quick Start if you are not sure how to do that.

Before you begin

To get your shipping methods your request should have at least the required request headers:

  • CountryId

There are optional parameters as following:

  • MaxItems
  • NextPagingToken

If you are not sure what MaxItems and NexPagingToken are, take a look Here

Get shipping methods

This step will teach you how to get shipping methods for your order.

First you must go to the Get Countries endpoint and select a country and then copy it's countryId. See Get countries if you are not sure how to do that.

Then you must go to the get priceGroups endpoint. Here you must enter a valid cultureCode in the path variable. If you are unsure of how to do this, please see Get priceGroups.

The next step is to go to the Get Catalogs endpoint. Here you will need to insert the priceGroupId from the previous endpoint in your path variables.

And lastly you must go to the get shipping methods endpoint. In the path variables, you must enter the countryId and the priceGroupId from the previous endpoints.

An example of how to get shipping methods could be:

    
    curl -D- -X POST https://ucommerce-headless-backend.azurewebsites.net/api/v1/api/v1/price-groups?cultureCode=en-GB \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    

If you get a successful response, you will get a list of shipping returned to you.

Example:

    
    {
    "pagingToken": null,
    "shippingMethods": [
         {
            "description": "Receive download link after download.",
            "displayName": "Download",
            "id": "2b54f836-9601-ec11-837b-64bc58542c92",
            "imageUrl": "https://mywebsite.com/image.png",
            "name": "Download",
            "price": {
            "amount": 0.0000,
            "currency": "EUR"
            }
         },
         {
            "description": null,
            "displayName": "Express",
            "id": "37236f68-8b55-4914-aeed-c9e96c637737",
            "imageUrl": "https://mywebsite.com/image.png",
            "name": "Express",
            "price": {
            "amount": 10.0000,
            "currency": "EUR"
            }
         },
         {
            "description": null,
            "displayName": "Standard (Free)",
            "id": "768e97ae-a725-41b6-8bca-6f30d72c9b6c",
            "imageUrl": "https://mywebsite.com/image.png",
            "name": "Standard (Free)",
            "price": {
            "amount": 0.0000,
            "currency": "EUR"
            }
         }
        ]
    }`
    

Now you can copy the Id of one of the shipping methods and use it for your other endpoints.

Possible errors that may occur:

Error Description
BadRequest (400) Shipping methods not found on the given context
NotFound (404) No shipping methods found on the given price group
Forbidden (403) Access token does not have access to current context

Example:

    
    {
    "errors": [
        {
        "error-description": "Shipping methods not found on the given context",
        "error": "BadRequest"
        }
     ]
    }
    

See Handling failures for more info