# 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

<table data-path-to-node="8" id="bkmrk-target-group-url-adm"><thead><tr><td>**Target Group**</td><td>**URL**</td></tr></thead><tbody><tr><td><span data-path-to-node="8,1,0,0">**Admin**</span></td><td><span data-path-to-node="8,1,1,0">`https://SUBDOMAIN.de/ws/V6/admin/JSON/Orders`</span></td></tr><tr><td><span data-path-to-node="8,2,0,0">**Advertiser**</span></td><td><span data-path-to-node="8,2,1,0">`https://SUBDOMAIN.de/ws/V6/advertiser/JSON/Orders`</span></td></tr></tbody></table>

---

## 🧪 Examples

#### Example with cURL

<div _ngcontent-ng-c1630465722="" class="code-block ng-tns-c1630465722-54 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" id="bkmrk-bash" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_872effa7e5419502","c_5229d7aaa2a28b5d",null,"rc_21ce8472f4b004f5",null,null,"en",null,1,null,null,1,0]]"><div _ngcontent-ng-c1630465722="" class="code-block-decoration header-formatted gds-title-s ng-tns-c1630465722-54 ng-star-inserted"><span class="ng-tns-c1630465722-54">Bash</span><div _ngcontent-ng-c1630465722="" class="buttons ng-tns-c1630465722-54 ng-star-inserted"><button aria-label="Code herunterladen" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger download-button ng-tns-c1630465722-54 mat-unthemed ng-star-inserted"></button><button aria-label="Code kopieren" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c1630465722-54 mat-unthemed ng-star-inserted"></button></div></div><div _ngcontent-ng-c1630465722="" class="formatted-code-block-internal-container ng-tns-c1630465722-54"><div _ngcontent-ng-c1630465722="" class="animated-opacity ng-tns-c1630465722-54"></div></div></div>```
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

```

<div _ngcontent-ng-c1630465722="" class="code-block ng-tns-c1630465722-54 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" id="bkmrk--3" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_872effa7e5419502","c_5229d7aaa2a28b5d",null,"rc_21ce8472f4b004f5",null,null,"en",null,1,null,null,1,0]]"><div _ngcontent-ng-c1630465722="" class="formatted-code-block-internal-container ng-tns-c1630465722-54"><div _ngcontent-ng-c1630465722="" class="animated-opacity ng-tns-c1630465722-54"></div></div></div>#### Code Example

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

**Headers:**

<table data-path-to-node="16" id="bkmrk-variable-value-%2F-mea"><thead><tr><td>**Variable**</td><td>**Value / Meaning**</td></tr></thead><tbody><tr><td><span data-path-to-node="16,1,0,0">**Content-Type**</span></td><td><span data-path-to-node="16,1,1,0">`application/json`</span></td></tr><tr><td><span data-path-to-node="16,2,0,0">**X-Network-ID**</span></td><td><span data-path-to-node="16,2,1,0">`-1`</span></td></tr><tr><td><span data-path-to-node="16,3,0,0">**X-Auth-Token**</span></td><td><span data-path-to-node="16,3,1,0">`ADMIN_APIUSER_TOKEN`</span></td></tr><tr><td><span data-path-to-node="16,4,0,0">**X-Auth-ID**</span></td><td><span data-path-to-node="16,4,1,0">`ADMIN_APIUSER_LOGIN_ID`</span></td></tr></tbody></table>

**Body:**

<div _ngcontent-ng-c1630465722="" class="code-block ng-tns-c1630465722-55 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" id="bkmrk-json" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_872effa7e5419502","c_5229d7aaa2a28b5d",null,"rc_21ce8472f4b004f5",null,null,"en",null,1,null,null,1,0]]"><div _ngcontent-ng-c1630465722="" class="code-block-decoration header-formatted gds-title-s ng-tns-c1630465722-55 ng-star-inserted"><span class="ng-tns-c1630465722-55">JSON</span><div _ngcontent-ng-c1630465722="" class="buttons ng-tns-c1630465722-55 ng-star-inserted"><button aria-label="Code herunterladen" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger download-button ng-tns-c1630465722-55 mat-unthemed ng-star-inserted"></button><button aria-label="Code kopieren" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c1630465722-55 mat-unthemed ng-star-inserted"></button></div></div><div _ngcontent-ng-c1630465722="" class="formatted-code-block-internal-container ng-tns-c1630465722-55"><div _ngcontent-ng-c1630465722="" class="animated-opacity ng-tns-c1630465722-55"></div></div></div>```
[
    {
        "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"
    }
]

```

<div _ngcontent-ng-c1630465722="" class="code-block ng-tns-c1630465722-55 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" id="bkmrk--5" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_872effa7e5419502","c_5229d7aaa2a28b5d",null,"rc_21ce8472f4b004f5",null,null,"en",null,1,null,null,1,0]]"><div _ngcontent-ng-c1630465722="" class="formatted-code-block-internal-container ng-tns-c1630465722-55"><div _ngcontent-ng-c1630465722="" class="animated-opacity ng-tns-c1630465722-55"></div></div></div>---

### 🧾 Parameter Explanations

#### Headers

<table data-path-to-node="22" id="bkmrk-variable-meaning-dat"><thead><tr><td>**Variable**</td><td>**Meaning**</td><td>**Data Type**</td></tr></thead><tbody><tr><td><span data-path-to-node="22,1,0,0">**Content-Type**</span></td><td><span data-path-to-node="22,1,1,0">The Content-Type of the request</span></td><td><span data-path-to-node="22,1,2,0">String</span></td></tr><tr><td><span data-path-to-node="22,2,0,0">**X-NETWORKID**</span></td><td><span data-path-to-node="22,2,1,0">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.</span></td><td><span data-path-to-node="22,2,2,0">Integer</span></td></tr><tr><td><span data-path-to-node="22,3,0,0">**X-AUTH-TOKEN**</span></td><td><span data-path-to-node="22,3,1,0">The API authentication token of the admin user is stored here.</span></td><td><span data-path-to-node="22,3,2,0">String</span></td></tr><tr><td><span data-path-to-node="22,4,0,0">**X-AUTH-ID**</span></td><td><span data-path-to-node="22,4,1,0">The ID of the admin user is stored here.</span></td><td><span data-path-to-node="22,4,2,0">Integer</span></td></tr></tbody></table>

#### Body

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

<table data-path-to-node="25" id="bkmrk-parameter-explanatio"><thead><tr><td>**Parameter**</td><td>**Explanation**</td><td>**Data Type**</td><td>**Required**</td></tr></thead><tbody><tr><td><span data-path-to-node="25,1,0,0">**id**</span></td><td>The transaction ID.

  
Format: `"id":"ID"`

</td><td><span data-path-to-node="25,1,2,0">String</span></td><td><span data-path-to-node="25,1,3,0">Yes (or `ordertoken`)</span></td></tr><tr><td><span data-path-to-node="25,2,0,0">**ordertoken**</span></td><td>The order token.

  
Format: `"ordertoken":"ORDERTOKEN"`

</td><td><span data-path-to-node="25,2,2,0">String</span></td><td><span data-path-to-node="25,2,3,0">Yes (or `id`)\*</span></td></tr><tr><td><span data-path-to-node="25,3,0,0">**campaign\_id**</span></td><td>The campaign ID.

  
Format: `"campaign_id":CAMPAIGN_ID`

</td><td><span data-path-to-node="25,3,2,0">Integer</span></td><td><span data-path-to-node="25,3,3,0">Yes</span></td></tr><tr><td><span data-path-to-node="25,4,0,0">**trigger\_id**</span></td><td>The trigger ID.

  
Format: `"trigger_id":TRIGGER_ID`

</td><td><span data-path-to-node="25,4,2,0">Integer</span></td><td><span data-path-to-node="25,4,3,0">No, only if `ordertoken` is used.\*</span></td></tr><tr><td><span data-path-to-node="25,5,0,0">**status**</span></td><td>The status of the order.

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

</td><td><span data-path-to-node="25,5,2,0">Integer</span></td><td><span data-path-to-node="25,5,3,0">No</span></td></tr><tr><td><span data-path-to-node="25,6,0,0">**turnover**</span></td><td>The order value of the transaction in campaign currency.

  
Format: `"turnover":TURNOVER`

</td><td><span data-path-to-node="25,6,2,0">Float</span></td><td><span data-path-to-node="25,6,3,0">No</span></td></tr><tr><td><span data-path-to-node="25,7,0,0">**original\_turnover**</span></td><td>The order value of the transaction in foreign currency.

  
Format: `"original_turnover":FOREIGN_CURRENCY_TURNOVER`

</td><td><span data-path-to-node="25,7,2,0">Float</span></td><td><span data-path-to-node="25,7,3,0">No</span></td></tr><tr><td><span data-path-to-node="25,8,0,0">**commission**</span></td><td><span data-path-to-node="25,8,1,0">The commission amount in campaign currency, if you prefer to calculate the commission yourself.</span></td><td><span data-path-to-node="25,8,2,0">Float</span></td><td><span data-path-to-node="25,8,3,0">No</span></td></tr><tr><td>---

<span data-path-to-node="25,9,0,0">**cancel\_reason**</span></td><td>Provide the reason for cancellation.

  
Format: `"cancel_reason":"Cancellation Reason"`

</td><td><span data-path-to-node="25,9,2,0">String</span></td><td><span data-path-to-node="25,9,3,0">No</span></td></tr></tbody></table>

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