Introduction

The Revers.io API is based on REST principle, using JSON-encoded bodies, and returning json-encoded responses.

We use standard HTTP verbs and response codes.

It is designed for Server to Server calls, and such should not be used from client applications directly.

Authenticating with the API

Using any API requires a Subscription Key and an API Token

Picture

Obtaining a Subscription Key and Api Token

This operation is only necessary the first time you use our APIs or when you need to change your API token.
Connect to the API key management page and create a new application. This will provide you with two Subscription Key / Api Token pairs (to allow for easy rotations).

Obtaining a JWT Token

In order to use any API, you need to acquire a JWT token using your Subscription Key / Api Token pair.

Note that such a token has a validity of one hour and should be regenerated accordingly. You can find the expiration date of a token by decoding the token and use the exp claim. 
To obtain said token, call the Get token API with the proper Headers set.

curl https://customer-api.revers.io/api/v1/token

-H "Ocp-Apim-Subscription-Key: {subscription key}"

-H "Ocp-Apim-Secret-Value: {secret value}"

Pass your subscription key using the Ocp-Apim-Subscription-Key header and your secret using Ocp-Apim-Secret-Value header.
Under no circumstances should you send your Api Key to another API.

curl https://customer-api.revers.io/api/v1/orders/{orderReference}/status

-H "Ocp-Apim-Subscription-Key: {subscription key}"

-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxx"

Using a JWT token

For any subsequent API call, authentification is insured by usage of the JWT Token as a Bearer Token in the Authorization header as well as the Subscription Key.

For clarity, we will omit these two headers in the next paragraphs of this article.

Import Model & Order

To trigger any AfterSales File creation, we need to enter Order data in the platform, referencing the Product Model.

In this section, you will learn how you can create a Model in Catalog, representing the sold Product, and how to use it to create your first Order.

POST https://customer-api.revers.io/api/v1/catalog/models
{
    "label": "Fairphone 3+ 64GB",
    "sKU": "123456",
    "brandName": "Fairphone",
    "modelTypeUniqueName": "Smartphone",
    "state": "New",
    "weight": 0.188,
    "dimension":
    {
        "lengthInCm": 16,
        "widthInCm": 7,
        "heightInCm": 1
    }
}
{
    "value":
    {
       "id": "10000000-5555-0000-0000-000000000001",
       [...]
    }
}

Create Model

Let's create our first Model, representing a Product.

It should have

  • A unique id called SKU, and a label (visible from users)

  • An association with a Brand through the brandName. it will be created if the Brand does not exists yet.

  • An association with a Model Type (Category) through the modelTypeUniqueName. Tree of ModelTypes has been defined with the Delivery team.

  • Some information relative to dimension and weight, and state of the model

PUT https://customer-api.revers.io/api/v1/orders
{
    "orderReference": "ORDER-00001",
    "customerLastName": "Dumbledore",
    "customerFirstName": "Albus",
    "address": {
        "streetAddress": "79 quai de la Gare",
        "zipCode": "75013",
        "city": "Paris",
        "countryCode": "FR",
        "phone": "+33600000000"
    },
    "phoneNumber": "+33600000000",
    "customerMail": "[email protected]",
    "purchaseDateUtc": "2021-06-01TT14:46:28Z",
    "products": [
        {
            "modelId": "10000000-5555-0000-0000-000000000001",
            "price": {
                "amount": 495,
                "currency": "EUR"
            },
            "orderLineReference": "0",
        }
    ],
    "shippingPrice": {
        "amount": 4.3,
        "currency": "EUR"
    },
    "salesChannel": "Online Store"
}
{
    "value":
    {
       "id": "10000000-9999-0000-0000-000000000001",
       [...]
    }
}

Create Order

Add the Order in Revers.io to create context for the After Sales File creation.

It contains:

  • A unique identifier called orderReference

  • Customer information

  • A purchaseDate

  • A salesChannel enabling to activate specific rules in cas you need it

  • List of bought products with their price

  • The shippingPrice

POST https://customer-api.revers.io/api/v1/links
{
    "orderId": "10000000-9999-0000-0000-000000000001"
}
{
    "value": "https://d.revers.io/d/v1/t/XXXXXXX"
}

Redirect Customer

Create a link with token to redirect the Customer to the Self Care portal on this created Order.