Adrecord Internal API Documentation

The API allow the user to do things in the Adrecord system. In order to use the API, you must first get an API-key for the developers.

You can find a list of available commands below with an example of the output. All output is provided as JSON. If you have any questions regarding the API, feel free to contact api@adrecord.com.

Changelog

  • 2019-04-01 - Init.

Introduction

The API-key can be sent as both a GET or POST variable, as well as a HTTP-header named APIKEY, like this:

GET /channels HTTP/1.1
Host: scofield.adrecord.com
Apikey: <your secret API-key>

HTTP/1.1 200 Found
...

Base URL

The base url for all API endpoints is https://scofield.adrecord.com

Notes

  • Encoding: Strings passed to the API should be UTF-8 encoded.
  • Date format: All dates are in ISO 8601.

Headers

  • apikey: string to authenticate.

Inputs

The API only supports JSON. So instead of XML, HTTP POST parameters, or other serialization formats, POST and PATCH requests require a valid JSON object for the body.

Errors

Code Description
200 OK Successful request.
400 Bad request The server cannot process the request due to an apparent client error.
401 Unauthorized The request requires authentication.
404 Not Found The requested resource could not be found.
409 Conflict The request could not be processed because of conflict in the current state of the resource.
429 Too Many Requests You have sent too many requests in a given amount of time.
500 Internal Server Error Unexpected behavior on the server level.

Example message for 409:

{
    "status": "error",
    "message": "Wrong status format. Set status to either \"rejected\" or \"approved\"."
}

If you’re seeing a 5xx error, that likely means there’s an error on Adrecord’s side, and you can contact our support team at api@adrecord.com.

Throttling

To improve connections and experiences for all our users, we use some connection limits to avoid overload. Each user is permitted up to 100 request per 30 seconds, and you’ll receive an error message if you reach the limit. The reached limit will be reset after 5 minutes.

Resources

GET /returns/:programID/:hash

List your latest transactions. By default the limit is set to 10, and the result is sorted by descending date. Manual transactions is added extra money to your account, for example bonuses or prize money in affiliate competitions. They will also come with a comment.

Input Parameters

Parameter Type Description
programID int ProgramID
hash string The list-hash

Result

{
    "audit": {
        "returnID": "4105",
        "programID": "786",
        "programName": "TEST ADVERTISER",
        "programLogo": "https://www.adrecord.com/img/logos/786.gif",
        "auth": "e81b29985ba36d6a05e276a7fcf080c1c84a546a",
        "date": "2017-05-31",
        "created": "2017-06-15 00:00:03",
        "columns": null,
        "confirm": "0",
        "sent": "1",
        "processed": "0",
        "revoked": "0",
        "data": null,
        "auditMinCommission": "0"
    },
    "transactions": {
        "899170": {
            "transactionID": "899170",
            "clickID": "29812849",
            "transactionType": "auto",
            "coupon": "0",
            "programID": "786",
            "channelID": "18937",
            "campaignID": "0",
            "commID": "1739",
            "currency": "SEK",
            "publisherCommissions": "1337",
            "publisherCommissionsFixed": false,
            "commInvoicedSEK": null,
            "commPaidSEK": null,
            "earnings": "401",
            "earningsFixed": false,
            "earnInvoicedSEK": null,
            "earnPaidSEK": null,
            "agentID": "0",
            "datetime": "2017-02-24 20:21:01",
            "isales_datetime": null,
            "orderValue": "11138",
            "orderID": "103618",
            "orderComment": null,
            "subID": null,
            "ipaddress": "127.0.0.1",
            "hide": "0",
            "comment": null,
            "admincomment": null,
            "qty": "0",
            "status": 1,
            "eai": "",
            "epi": "",
            "keywords": "0",
            "os": "mac",
            "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
            "tracktype": "click",
            "frozen_clicks": "0",
            "expired_clicks": "0",
            "weather": null,
            "mail": "example.name@example.com",
            "firstName": "Example",
            "lastName": "Name",
            "userID": "10555",
            "clickdate": null,
            "channelUrl": "http://example.com",
            "channelName": "Personal blog",
            "channelType": "W",
            "order": "Sale 12"
        },
        ...
    }
}

PATCH /returns/:programID/:hash

To save the edited transactions send all the data as json, see example below. Where the array indexes match, i.e. index #5 in the transactionID-array corresponds to the index #5 in the orderValue-array.

Input Parameters

Parameter Type Description
transactionID int The transactions ID
orderValue int The order value in Öre
publisherCommissions int The commission in Öre
comment string The reason why the transaction is rejected. Only applicable if status is rejected.
status int 1 = Approved, 2 = Pending, 6 = Rejected

Example input

{
    "transactionID": [
        201,
        202,
        203,
        204,
        205
    ],
    "orderValue": [
        48000,
        52000,
        78900,
        45650,
        127800
    ],
    "publisherCommissions": [
        4800,
        5200,
        7890,
        4565,
        12780
    ],
    "comment": [
        null,
        null,
        null,
        'Return',
        'Fraud'
    ],
    "status": [
        1,
        1,
        2,
        6,
        6
    ]
}

Result

{
    status: 'OK'
}

PATCH /returns/:programID/:hash/submit

To submit the edited transactions send all the data as json, see example above on the save endpoint.

Input Parameters

Parameter Type Description
transactionID int The transactions ID
orderValue int The order value in Öre
publisherCommissions int The commission in Öre
comment string The reason why the transaction is rejected. Only applicable if status is rejected.
status int 1 = Approved, 2 = Pending, 6 = Rejected

Example input

{
    "transactionID": [
        201,
        202,
        203,
        204,
        205
    ],
    "orderValue": [
        48000,
        52000,
        78900,
        45650,
        127800
    ],
    "publisherCommissions": [
        4800,
        5200,
        7890,
        4565,
        12780
    ],
    "comment": [
        null,
        null,
        null,
        'Return',
        'Fraud'
    ],
    "status": [
        1,
        1,
        2,
        6,
        6
    ]
}

Result

{
    status: 'OK'
}