API Documentation

Access And Security

Making requests to the Affjet RESTful API

AffJet’s webservice is consumed via HTTP(S). Depending on the API method being called you will need to use one of GET, POST, PUT, DELETE. All API calls return a JSON object as their response.

 

Security

In order to make a request to any of the webservices you need to include your API key as an apikey parameter of the request URL. Your API key can be obtained from the Company Details section of the AffJet application and identifies you exclusively.

I.E.:

https://api.affjet.com/externalclient/affiliateNetwork?apikey=<<YOUR_API_KEY>>

Field Types

The following data types may be returned by the API:

  • Integer: Literal represented with single integer numbers, without any other signs or characters.
  • Double:¬†Literal represented with numbers and a decimal point to separate the decimal values.
  • String: String contained within quotation marks (“).
  • Date: String representation of the date in the format “YYYYMMDD”. For Example “20180724” represents 24th of July of 2018.
  • Datetime: String representation of the data and time in the format “YYYYMMDDHHmmss”. For example “20180724153256” represents 15:32:56 on the 24th of July of 2018.
  • Boolean: Literal “true” or “false”.

 

Output

Each request has its own response output, but there are some fields common to many of them:

Field Name Type Description
result Integer A numeric code representing the result of the request.
  • 0: Everything has gone well, and the response is a valid one.
  • 100: The given apikey is not valid.
  • 200: One or more of the parameters included in the request are incorrect.
  • 300: You have requested a single value and it does not exist.
  • 400: An internal error has occured happened. Try again later or contact us.
time Double The length of time in milliseconds that the server has spent in process your request.
dataCount Integer Only present when you make a request to an endpoint that returns a list of items. In this case, this field is represents the total number of items included in the response.
errors list of strings If an error has occurred while processing your request, this field is filled with a description of the source of the error.

Affiliate Network List

Description

Return a list of affiliate networks.

Url

/externalclient/affiliateNetwork

Response

A request to this endpoint will return the following JSON object:
{
"result": Integer,
"time": Double,
"dataCount": Integer,
"dataList":[
{
"id": Integer,
"name": String,
"importDate": Datetime,
"lastImportDate": Datetime,
"currency": String
"merchants": [
{
"id": Integer
"name": String
}
... more elements
],
}
... more elements
]
}
Field Name Description
result See 'Access and Security'.
time See 'Access and Security'.
dataCount See 'Access and Security'.
dataList List of Affiliate Network Items. Each of these elements is made up of:
  • id: A numeric ID for the network. Used to identify this network within AffJet.
  • name: A name to identify this network.
  • importDate: Datetime when data was first imported.
  • lastImportDate: Datetime when data was last imported.
  • currency: Currency the Affiliate Network report transactions in.
  • merchants: (Optional, see parameter 'includeMerchants') A list of items containing the different merchants that are associated to this network.
    • id: A numeric ID for the merchant. Used to identify this merchant within AffJet.
    • name: A name to identify this merchant.
    • cid: A numeric ID given to this merchant by the Affiliate Network. Used to identify this merchant within the Affiliate Network.

Parameters to filter data

Name Type Description
count Boolean When set to true, only the count of the number of elements that would be returned is given. In this case dataList is empty and only the field dataCount is populated. Defaults to false.
includeMerchants Boolean When set to true the merchants field of dataList is populated for every network. Defaults to false.
order String A string representation of the dataList elements used to sort the returned list. The string is a comma-separated list of the field name followed by a dash and either asc (for ascending order) or desc for descending order). For example, to sort by name descending and then import date ascending, this field would be name-desc,importDate-asc. Defaults to blank, default ordering.

Affiliate Network By Id

Description

Return details of a specific Affiliate Network based on the AffJet ID of that Network.

Url

/externalclient/affiliateNetwork/<<id>>
<<id>>
The AffJet ID of the Affiliate Network that you want to get the details of.

Response

A request to this endpoint will return the following JSON object:
{
"result": Integer,
"time": Double,
"data":
{
"id": Integer,
"name": String,
"importDate": Datetime,
"lastImportDate": Datetime,
"currency": String
"merchants": [
{
"id": Integer
"name": String
}
... more elements
],
}
}
Field Name Description
result See 'Access and Security'.
time See 'Access and Security'.
data Affiliate Network Item, made up of:
  • id: A numeric ID for the network. Used to identify this network within AffJet.
  • name: A name to identify this network.
  • importDate: Datetime when data was first imported.
  • lastImportDate: Datetime when data was last imported.
  • currency: Currency the Affiliate Network report transactions in.
  • merchants: (Optional, see parameter 'includeMerchants') A list of items containing the different merchants that are associated to this network.
    • id: A numeric ID for the merchant. Used to identify this merchant within AffJet.
    • name: A name to identify this merchant.
    • cid: A numeric ID given to this merchant by the Affiliate Network. Used to identify this merchant within the Affiliate Network.

Parameters to filter data

Name Type Description
includeMerchants Boolean When set to true the merchants field of dataList is populated. Defaults to false.

Merchant List

Description

Return a list of merchants.

Url

/externalclient/merchant

Output

A request to this endpoint will return the following JSON object:
{
"result": Integer,
"time": Double,
"dataCount": Integer,
"dataList":[
{
"id": Integer,
"name": String,
"cid": String,
"affiliateNetwork": [
{
"id": Integer,
"name": String,
"importDate": Date,
"lastImportDate": Date,
"currency": String
}
... more elements
],
}
... more elements
]
}
Field Name Description
result See 'Access and Security'.
time See 'Access and Security'.
dataCount See 'Access and Security'.
dataList List of Merchant Items. Each of these elements is made up of:
  • id: A numeric ID for the merchant. Used to identify this merchant within AffJet.
  • name: A name to identify this merchant.
  • cid: A numeric ID given to this merchant by the Affiliate Network. Used to identify this merchant within the Affiliate Network.
  • affiliateNetwork: Details of the Affiliate Network managing this merchant. Made up of the following
    • id: A numeric ID for the network. Used to identify this network within AffJet.
    • name: A name to identify this network.
    • importDate: Datetime when data was first imported.
    • lastImportDate: Datetime when data was last imported.
    • currency: Currency the Affiliate Network report transactions in.

Parameters to filter data

Name Type Description
count Boolean When set to true, only the count of the number of elements that would be returned is given. In this case dataList is empty and only the field dataCount is populated. Defaults to false.
includeAffiliateNetwork Boolean When set to true the affiliateNetwork field of dataList is populated for every network. Defaults to false.
order String A string representation of the dataList elements used to sort the returned list. The string is a comma-separated list of the field name followed by a dash and either asc (for ascending order) or desc (for descending order). For example, to sort by name descending and then import date ascending, this field would be name-desc,importDate-asc. Defaults to blank, default ordering.

Merchant by Id

Description

Return details of a specific merchant based on the AffJet ID of that merchant.

Url

/externalclient/merchant/<<id>>
<<id>>
The AffJet ID of the merchant that you want to get the details of.

Output

A request to this endpoint will return the following JSON object:
{
"result": Integer,
"time": Double,
"data":
{
"id": Integer,
"name": String,
"affiliateNetwork": [
{
"id": Integer,
"name": String,
"cid": String,
"importDate": Datetime,
"lastImportDate": Datetime,
"currency": String
}
... more elements
}
... more elements
]
}
Field Name Description
result See 'Access and Security'.
time See 'Access and Security'.
data Merchant item, made up of:
  • id: A numeric ID for the merchant. Used to identify this merchant within AffJet.
  • name: A name to identify this merchant.
  • cid: A numeric ID given to this merchant by the Affiliate Network. Used to identify this merchant within the Affiliate Network.
  • affiliateNetwork: Details of the Affiliate Network managing this merchant. Made up of the following
    • id: A numeric ID for the network. Used to identify this network within AffJet.
    • name: A name to identify this network.
    • importDate: Datetime when data was first imported.
    • lastImportDate: Datetime when data was last imported.
    • currency: Currency the Affiliate Network report transactions in.

Parameters to filter data

Name Type Description
includeAffiliateNetwork Boolean When set to true the merchants field of dataList is populated. Defaults to false.

Overview List

Description

Get a summary of transactions, grouped by merchant, for a given timeframe.

Url

/externalclient/overview

Output

A request to this endpoint will return the following JSON object:
{
"result": Integer,
"time": Double,
"dataCount": Integer,
"dataList":[
{
"date": Date,
"merchant"
{
"id": Integer
},
"transactionNumber": Double
"totalValue": Double
"transactionConfirmedValue": Double
"transactionPendingValue": Double
"transactionPaidValue": Double
"transactionDeclinedValue": Double
"totalCommission": Double
"commissionRate": Double
"transactionConfirmedCommission": Double
"transactionPendingCommission": Double
"transactionPaidCommission": Double
"transactionDeclinedCommission": Double
}
... more elements
]
}
Field Name Description
result See 'Access and Security'.
time See 'Access and Security'.
dataCount See 'Access and Security'.
dataList List of Overview items. Each of these elements is made up of:
  • date (Optional): The date of this overview.
  • merchant: The merchant that this group of transactions relates to.
    • id A numeric ID for the merchant. Used to identify this merchant within AffJet.
  • transactionNumber: The number of transactions counted in this overview.
  • totalValue: Total value of transactions in this overview.
  • transactionConfirmedValue: Total value of confirmed transactions in this overview.
  • transactionPendingValue: Total value of pending transactions in this overview.
  • transactionPaidValue:Total value of paid transactions in this overview.
  • transactionDeclinedValue: Total value of declined transactions in this overview.
  • totalCommission: Total value of commission in this overview.
  • commissionRate: Total commission rate over value in this overview.
  • transactionConfirmedCommission: Total value of confirmed commission in this overview.
  • transactionPendingCommission: Total value of pending commission in this overview.
  • transactionPaidCommission: Total value of paid commission in this overview.
  • transactionDeclinedCommission: Total value of declined commission in this overview.

Parameters to filter data

Name Type Description
count Integer When set to true, only the count of the number of elements that would be returned is given. In this case dataList is empty and only the field dataCount is populated. Defaults to false.
groupByMerchant Integer Optional parameter, only send if you want to group all the transactions by merchant. To get this field working, you have to set it to true. In this case, all the overview of each merchant will be grouped, their values added and the date field would be always empty.
dateFrom Date Optional parameter of type Date. In case that it is included, the result will only return the overviews which date is greater or equal to it.
dateTo Date Optional parameter of type Date. In case that it is included, the result will only return the overviews which date is lower or equal to it.
pageSize Integer The number of results to return for this request. Can be used in combination with pageIndex to paginate results from the API. Defaults to 1000. It is ignored when parameter 'count' is set to true.
pageIndex Integer The page number to return, starting at 0. Used in combination with pageSize to paginate results. Defaults to 0. It is ignored when parameter 'count' is set to true.
merchantId Integer Return only overviews associated with the given merchantId. By default all merchants are returned.
affiliateNetworkId Integer Return only overviews associated with the given affiliateNetworkId. By default all Affiliate Networks are returned.
order String A string representation of the dataList elements used to sort the returned list. The string is a comma-separated list of the field name followed by a dash and either asc (for ascending order) or desc (for descending order). For example, to sort by total value ascending and then commission rate descending, this field would be totalValue-asc,commissionRate-desc. Defaults to blank, default ordering. It is ignored when parameter 'count' is set to true.

Transaction List

Description

Get a full list of transactions.

Url

/externalclient/transaction

Output

A request to this endpoint will return the following JSON object:
{
"result": Integer,
"time": Double,
"dataCount": Integer,
"dataList":[
{
"date": Datetime
"lastUpdate": Datetime
"amount": Double
"commission": Double
"status": String
"merchant":
{
"id": Integer
},
"uniqueId": String,
"customId": String,
"commissionRate": Double,
"historicStatus": [
{
"date": Datetime
"status": String
},
... more elements
],
"historicAmends": [
{
"date": Datetime
"amount": Datetime
"commission": Datetime
"status": Datetime
"uniqueId": Datetime
"customId": Datetime
"updateTime": Datetime
},
... more elements
]
}
... more elements
]
}
Field Name Description
result See 'Access and Security'.
time See 'Access and Security'.
dataCount See 'Access and Security'.
dataList List of transaction items. Each of these elements is made up of:
  • date: The datetime of this transaction
  • lastUpdate: The last datetime that this transaction was updated by the affiliate network.
  • merchant: The merchant that this transaction relates to
    • id A numeric ID for the merchant. Used to identify this merchant within AffJet.
  • amount: The value of this transaction.
  • commission: The commission amount for this transaction.
  • status: The current status of this transaction.
  • uniqueId: A unique ID for this transaction.
  • customId: A custom ID for this transaction.
  • commissionRate: The rate of commission paid for this transaction.
  • historicStatus:
    • date The time when this transaction was updated with this state.
    • status The status of this transaction at the moment when this record was created.
  • historicAmends:
    • date The datetime of this transaction.
    • amount The amount of this transaction at the moment when this record was created
    • commission The commission of this transaction at the moment when this record was created.
    • status The status of this transaction at the moment when this record was created.
    • uniqueId The uniqueId of this transaction at the moment when this record was created.
    • customId The customId of this transaction at the moment when this record was created.
    • updateTime The time when this transaction was updated with these values.

Parameters to filter data

Name Type Description
count Boolean When set to true, only the count of the number of elements that would be returned is given. In this case dataList is empty and only the field is populated. Defaults to false.
dateFrom Datetime Optional parameter of type DateTime. In case that it is included, the result will only return the transactions which date is greater or equal to it.
dateTo Datetime Optional parameter of type DateTime. In case that it is included, the result will only return the transactions which date is lower or equal to it.
lastUpdateFrom Datetime Optional parameter of type DateTime. In case that it is included, the result will only return the transactions which last update date is greater or equal to it.
lastUpdateTo Datetime Optional parameter of type DateTime. In case that it is included, the result will only return the transactions which last update date is lower or equal to it.
pageSize Integer The number of results to return for this request. Can be used in combination with pageIndex to paginate results from the API. Defaults to 1000. It is ignored when parameter 'count' is set to true.
pageIndex Integer The page number to return, starting at 0. Used in combination with pageSize to paginate results. Defaults to 0. It is ignored when parameter 'count' is set to true.
merchantId Integer Return only transaction associated with the given merchantId. By default all merchants are returned.
affiliateNetworkId Integer Return only transactions associated with the given affiliateNetworkId. By default all Affiliate Networks are returned.
customId String Return only transactions with the given customId. Defaults to blank, all transactions are returned.
uniqueId String Return only transactions with the given uniqueId. Defaults to blank, all transactions are returned.
order String A string representation of the dataList elements used to sort the returned list. The string is a comma-separated list of the field name followed by a dash and either asc (for ascending order) or desc (for descending order). For example, to sort by total value ascending and then commission rate descending, this field would be totalValue-asc,commissionRate-desc. Defaults to blank, default ordering. It is ignored when parameter 'count' is set to true.
includeStatusHistory Boolean When set to true the historicStatus field of dataList is populated for every transaction. Defaults to false.
includeAmendHistory Boolean When set to true the historicAmends field of dataList is populated for every transaction. Defaults to false.
Site copyright Fubra Limited © 2010 - 2018