Skip to main content
Skip table of contents

edoobox API first steps

Please note that free support for this subject area is limited. If you require more extensive support, we are happy to offer you paid services.

Authentication with API key

Generate API key

The API V2 uses the API keys from V2. These must first be generated in your V2 account:

  1. Go to Settings > API access management navigate.

  2. Click on Add key to generate a new key.

  3. Select the desired right and then click on Add.

  4. You will now receive two unique API keys that you can use to authenticate yourself with the API V2. Keep these keys in a safe place, as they are only issued once in full.

Authentication and receipt of access tokens

The authentication endpoints are not protected. All protected API V2 endpoints can only be used with a access_token and one edid can be used. The edid defines which account is currently authenticated. To use this access_token and the edid you must use the API keys and authenticate yourself first. The endpoint to authenticate is: https://app2.edoobox.com/v2/auth.

Below you will find a few examples of authentication in different programming languages. The key is your public key, which secret is your secret key and expire you can use to set the expiration date of the access_tokens to be determined.

In the answer you will find the edid and your valid access_token. You will also find the rights of the accounts currently logged in and their account ID. You can access them as follows:

CODE
data.login.data[edid]

Example of an API response after authentication

CODE
{
    "data": {
        // Die edid ID vom aktuellen Konto
        "edid": "63ef220a0c8f25O0O4833076730b351d639ea00000000000000000000",
        "login": {
            ...
            "data": {
                // alle aktiv eingeloggten Konten
                "63ef220a0c8f25O0O4833076730b351d639ea00000000000000000000": {
                    "id": "api_00000000_00000000",
                    "account": "account_00000000_00000000", // Konto ID
                    "auth": {
                        "rw": { // alle Rechte von diesen Schlüsseln
                            "admi": 3,
                            ...
                        }
                    }
                }
                "63ef220a0c8f25O0O4833076730b351d639ea0d4520f005f7f7347283": {
                    "id": "api_00000000_00000000",
                    "account": "account_00000000_00000001", // Konto ID
                    "auth": {
                        "sub": 1,
                        "rw": { // alle Rechte von diesen Schlüsseln
                            "admi": 3,
                            ...
                        }
                    }
                }
            }
        }
    },
    // Ihr gültiger Access Token
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
    ...
}

Queries with code

Authentication

Authentication with Node (JavaScript)

We use the node version for these examples v18.13.0. Create a JavaScript file auth.js with the following content:

JS
var myHeaders = new Headers();
myHeaders.append("grant-type", "password");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "key": "key_0000000000000000000000000000000",
  "secret": "sec_0000000000000000000000000000000",
  "expire": "2030-01-01T01:00:00+02:00"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://app2.edoobox.com/v2/auth", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

In your shell, change to the directory of this file and execute the script:

BASH
node auth.js

Authentication with PHP

Create a PHP file auth.php with the following content:

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://app2.edoobox.com/v2/auth',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
	"key": "key_0000000000000000000000000000000",
	"secret":"sec_0000000000000000000000000000000",
	"expire":"2030-01-01T01:00:00+02:00"
}',
    CURLOPT_HTTPHEADER => array(
        'grant-type: password',
        'Content-Type: application/json',
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

In your shell, change to the directory of this file and execute the script:

BASH
php auth.php

Query of all offers

As soon as authentication has been completed, a cookie is written for your session. You now also have the edid and the access_token and can therefore make queries to the API. In this example, we will retrieve all offers from this account (provided you have selected the correct rights when creating the API key). The endpoint used for this is https://app2.edoobox.com/v2/offer/list. Pay attention to the headers edid, grant-type and Authorization. These are essential for the correct functioning of the queries. This also applies to all other protected endpoints.

Query with Node (JavaScript)

We use the node version for these examples v18.13.0. Create a JavaScript file offers.js with the following content. Replace eyJ0eXAiOiJKV... in the Authorization-header with your own access token:

JS
var myHeaders = new Headers();
myHeaders.append("edid", "63ef220a0c8f25O0O4833076730b351d639ea00000000000000000000");
myHeaders.append("grant-type", "access_token");
myHeaders.append("Authorization", "Bearer eyJ0eXAiOiJKV...");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://app2.edoobox.com/v2/offer/list", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

In your shell, change to the directory of this file and execute the script:

BASH
node offers.js

Query with PHP

Create a PHP file offers.php with the following content. Replace eyJ0eXAiOiJKV... in the Authorization-header with your own access token:

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://app2.edoobox.com/v2/offer/list',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'edid: 63ef220a0c8f25O0O4833076730b351d639ea00000000000000000000',
        'grant-type: access_token',
        'Authorization: Bearer eyJ0eXAiOiJKV...',
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

In your shell, change to the directory of this file and execute the script:

BASH
php offers.php

Queries with Postman

With Postman you can easily test all interfaces to get a better understanding of the API.

  1. To do this, you must first install Postman using the installation instructions at the following link: https://www.postman.com/downloads/.

  2. Then log in with your Postman account.

  3. Visit our API documentation: https://api.docs.edoobox.com/.

  4. In our documentation, click on Run in Postman at the top right.

  5. You will then be asked whether you would like to open our API via the desktop application or in the browser. Click on the option that suits you, in this example we are using the desktop application.

  6. You may be asked to allow opening in your desktop application. Click on Allow. If this question is not asked and you land directly in your desktop application, go to the next point.

  7. Import our collection in the workspace of your choice.

  8. Navigate to Environments in Postman and import the attached environment file (example.postman_environment.json).

  9. Adjust your details in your newly imported environment (api_keyor user_email etc.).

  10. Go to our Collection under Collections and select the newly added environment in the top right-hand corner.

  11. Now you can register via Auth (Login) > POST (Login) authenticate. The access_token and all other information is automatically added to your environment file after authentication. The query POST Auth API is for when you use the API key for authentication. The query POST Auth Admin (Login) is for when you use the e-mail and password for authentication.

  12. After you have selected one of the two POST queries, you can execute all further queries in Postman.

example.postman_environment.json

Related instructions

Keywords for these instructions

API ¦ API V2 ¦ Postman ¦ Authentication

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.