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
-
Admin:
https://DOMAIN.de/ws/V6/admin/JSON/Orders -
Advertiser:
https://DOMAIN.de/ws/V6/advertiser/JSON/Orders
๐งช Example (cURL)
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:
-
ordertoken: Must be unique โ ideally a combination of a timestamp, shop ID, or external order number.
-
trigger_id: If you do not know this ID, check your campaign configuration in the frontend.
-
Bulk Actions: You can also create multiple orders at once by sending them within a single array.
-
Updates: If an order with the same
ordertokenalready exists in the system, a PUT request can be used to update it.
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.
-
User ID: Where is the User ID stored? (See frontend profile)
-
Access Token: Where is the Access Token stored? (See API settings)
๐ฉ 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
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:
[
{
"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: |
String | Yes (or ordertoken) |
| ordertoken |
The order token. Format: |
String | Yes (or id)* |
| campaign_id |
The campaign ID. Format: |
Integer | Yes |
| trigger_id |
The trigger ID. Format: |
Integer | No, only if ordertoken is used.* |
| status |
The status of the order. Values: |
Integer | No |
| turnover |
The order value of the transaction in campaign currency. Format: |
Float | No |
| original_turnover |
The order value of the transaction in foreign currency. Format: |
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: |
String | No |
*) Note: If the
ordertokenis used, thetrigger_idbecomes a mandatory field in addition to thecampaign_id.