Order Webservice

Create / easy.affiliate REST-API (Orders)

๐Ÿ“ Introduction

A REST-compliant web service is available to automatically create new orders within the easy.affiliate system. New transactions can be transmitted using the HTTP POST method. For this purpose, each user receives an authentication token and a login ID, which can be viewed in the frontend.


๐Ÿ” Authentication

The following headers are required to access the API:

Header Description Type
Content-Type Must be set to application/json String
X-Network-ID Network ID: typically -1 for cross-client (multi-tenant) API Integer
X-Auth-Token Your API token (visible in the frontend) String
X-Auth-ID Your login ID (visible in the frontend) Integer

๐Ÿ“ฉ Endpoints


๐Ÿงช Example (cURL)

Bash
curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-Network-ID: -1" \
  -H "X-Auth-Token: ADMIN_APIUSER_TOKEN" \
  -H "X-Auth-ID: ADMIN_APIUSER_LOGIN_ID" \
  -d '[{
    "ordertoken": "testorder001",
    "campaign_id": 1,
    "trigger_id": 2,
    "status": 1,
    "turnover": 199.99,
    "commission": 20.00
  }]' \
  https://SUBDOMAIN.de/ws/V6/admin/JSON/Orders

๐Ÿงพ Body Parameters

Parameter Description Data Type Required
ordertoken Unique identifier for the order. Must be system-wide unique. String โœ… Yes
campaign_id ID of the campaign to which the order is assigned. Integer โœ… Yes
trigger_id ID of the trigger, which is mandatory when using ordertoken. Integer โœ… Yes
status Status of the order: 0 = open, 1 = confirmed, 2 = canceled Integer โœ… Yes
turnover Order value in campaign currency Float โœ… Yes
original_turnover Order value in foreign currency Float No
commission Commission value in campaign currency. Can be passed if calculated manually. Float No
cancel_reason Specifies a reason for cancellation if status = 2 (canceled) String No

๐Ÿ“˜ Notes

Important implementation details:

Update / easy.affiliate REST-API (Orders)

๐Ÿ“ Introduction

To enable the automated processing of orders within the easy.affiliate system, easy Marketing GmbH provides a web service API. This allows you to modify existing orders after they have been created, as soon as they go through the validation process.

Each user has an Authentication Token and a Login ID available, which can be retrieved via the frontend.


๐Ÿ“ฉ Endpoints

Target Group URL
Admin https://SUBDOMAIN.de/ws/V6/admin/JSON/Orders
Advertiser https://SUBDOMAIN.de/ws/V6/advertiser/JSON/Orders

๐Ÿงช Examples

Example with cURL

Bash
curl -X PUT \
  -H "Content-Type: application/json" \
  -H "X-Network-ID: -1" \
  -H "X-Auth-Token: ADMIN_APIUSER_TOKEN" \
  -H "X-Auth-ID: ADMIN_APIUSER_LOGIN_ID" \
  -d '[{ "campaign_id": 1, "id": 12345, "status": 1, "turnover":100.00, "commission":12.34 },{ "campaign_id": 1, "ordertoken":"123a456b", "status": 2, "turnover": 0.00 }]' \
  https://DOMAIN/ws/V6/admin/JSON/Orders

Code Example

Multiple orders can be updated at once using the following format. An example request looks like this:

Headers:

Variable Value / Meaning
Content-Type application/json
X-Network-ID -1
X-Auth-Token ADMIN_APIUSER_TOKEN
X-Auth-ID ADMIN_APIUSER_LOGIN_ID

Body:

JSON
[
    {
        "id": "12345",
        "campaign_id": 1,
        "status": 1,
        "turnover": 10.00,
        "commission": 0.99
    },
    {
        "ordertoken": "123a456b",
        "campaign_id": 1,
        "trigger_id": 1,              
        "status": 2,
        "turnover": 9.99,
        "cancel_reason": "Cancellation Reason"
    }
]

๐Ÿงพ Parameter Explanations

Headers

Variable Meaning Data Type
Content-Type The Content-Type of the request String
X-NETWORKID The client (tenant) ID is entered here. If only one client exists or you are working across all clients, the value -1 must be entered. Integer
X-AUTH-TOKEN The API authentication token of the admin user is stored here. String
X-AUTH-ID The ID of the admin user is stored here. Integer

Body

The standard parameters are listed below. However, it is possible to update any available parameter via the API.

Parameter Explanation Data Type Required
id

The transaction ID.


Format: "id":"ID"

String Yes (or ordertoken)
ordertoken

The order token.


Format: "ordertoken":"ORDERTOKEN"

String Yes (or id)*
campaign_id

The campaign ID.


Format: "campaign_id":CAMPAIGN_ID

Integer Yes
trigger_id

The trigger ID.


Format: "trigger_id":TRIGGER_ID

Integer No, only if ordertoken is used.*
status

The status of the order.


Values: -5 (pending inquiry), 0 (open), 1 (confirmed), 2 (canceled)

Integer No
turnover

The order value of the transaction in campaign currency.


Format: "turnover":TURNOVER

Float No
original_turnover

The order value of the transaction in foreign currency.


Format: "original_turnover":FOREIGN_CURRENCY_TURNOVER

Float No
commission The commission amount in campaign currency, if you prefer to calculate the commission yourself. Float No

cancel_reason

Provide the reason for cancellation.


Format: "cancel_reason":"Cancellation Reason"

String No

*) Note: If the ordertoken is used, the trigger_id becomes a mandatory field in addition to the campaign_id.