API Documentation for the AffJet API | AffJet.com

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. e.g. 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

GET/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

GET/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

GET/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

GET/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

GET/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,
				"affiliateNetwork": {
					"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.
    • affiliateNetwork: The affiliate network that this group of transactions relates to.
      • id A numeric ID for the affiliate network. Used to identify this network 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 and max to 10000. 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

GET/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,
			"originalAmount": Double,
			"originalCommission": Double,
			"originalCurrency": String,		
			"originalStatus": String,
			"merchant": {
				"id": Integer,
				"affiliateNetwork": {
					"id": Integer  
				}
			},
			"uniqueId": String,
			"customId": String,
			"commissionRate": Double,
			"type": String,
			"transactionFlag": Integer,
			"historicAmends": [{
				"date": Datetime,
				"amount": Double,
				"commission": Double,
				"status": String,
				"originalAmount": Double,
				"originalCommission": Double,
				"originalCurrency": String,		
				"originalStatus": String,
				"uniqueId": String,
				"customId": String,
				"updateTime": Datetime,
			} ... more elements],
			"historicDeltas": [{
				"date": Datetime,
				"amount": Double,
				"commission": Double,
				"status": String,
				"originalAmount": Double,
				"originalCommission": Double,
				"originalCurrency": String,		
				"originalStatus": String,
				"uniqueId": String,
				"customId": String,
				"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.
    • affiliateNetwork: The affiliate network that this group of transactions relates to.
      • id A numeric ID for the affiliate network. Used to identify this network within AffJet.
  • amount: The value of this transaction.
  • commission: The commission amount for this transaction.
  • status: The current AffJet Status of this transaction.
  • originalStatus: The current Network Status of this transaction.
  • originalAmount: The value of this transaction, in original network currency.
  • originalCommission: The commission amount for this transaction, in original network currency.
  • originalCurrency: Original currency of the network.
  • uniqueId: A unique ID for this transaction.
  • customId: A custom ID for this transaction.
  • commissionRate: The rate of commission paid for this transaction.
  • type: The type of record, bonus or transaction.
  • transactionFlag:
    • “”: Empty Value.
    • 0: Correct transaction type.
    • 1: Bonus suspect to be a transaction.
    • 2: Transaction suspect to be a bonus.
  • 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.
    • originalStatus: The current Network Status of this transaction.
    • originalAmount: The value of this transaction, in original network currency.
    • originalCommission: The commission amount for this transaction, in original network currency.
    • originalCurrency: Original currency of the network.
    • uniqueId The uniqueId of this amend.
    • 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.
  • historicDeltas:
    • date The datetime of this transaction. (Optional, only included if distinct from previous amend)
    • amount The amount of this transaction at the moment when this record was created (Optional, only included if distinct from previous amend)
    • commission The commission of this transaction at the moment when this record was created (Optional, only included if distinct from previous amend).
    • status The status of this transaction at the moment when this record was created (Optional, only included if distinct from previous amend).
    • originalStatus: The current Network Status of this transaction (Optional, only included if distinct from previous amend).
    • originalAmount: The value of this transaction, in original network currency (Optional, only included if distinct from previous amend).
    • originalCommission: The commission amount for this transaction, in original network currency (Optional, only included if distinct from previous amend).
    • originalCurrency: Original currency of the network (Optional, only included if distinct from previous amend).
    • uniqueId The uniqueId of this amend.
    • customId The customId of this transaction at the moment when this record was created (Optional, only included if distinct from previous amend).
    • 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 and max to 10000. 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.
includeAmendHistory Boolean When set to true the historicAmends field of dataList is populated for every transaction. Defaults to false.
includeDeltaHistory Boolean When set to true the historicDeltas field of dataList is populated for every transaction. Defaults to false.
type String Filter by transaction or bonus. Values allowed: bonus, transaction.

Total Values

Description

Get a sum of each value for a date range. Can be grouped by merchang, affiliateNetwork or date or not grouped and get total values.

Url

GET/externalclient/totalvalues

Output

A request to this endpoint will return the following JSON object:

	{
		"result": Integer,
		"time": Double,
		"dataCount": Integer,
		"dataList":[{
			"date": Date
			"affiliateNetwork": Integer  
			"merchant": 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 summed values. Each of these elements is made up of:
  • date (Optional): The date of this result (Only included if groupBy parameter is set to date).
  • affiliateNetwork (Optional): A numeric ID for the affiliate network. Used to identify this network within AffJet. (Only included if groupBy parameter is set to affiliateNetwork).
  • merchant (Optional): A numeric ID for the merchant. Used to identify this merchant within AffJet. (Only included if groupBy parameter is set to merchant).
  • transactionNumber: The number of transactions counted in this result.
  • totalValue: Total value of transactions in this result.
  • transactionConfirmedValue: Total value of confirmed transactions in this result.
  • transactionPendingValue: Total value of pending transactions in this result.
  • transactionPaidValue:Total value of paid transactions in this result.
  • transactionDeclinedValue: Total value of declined transactions in this result.
  • totalCommission: Total value of commission in this result.
  • commissionRate: Total commission rate over value in this result.
  • transactionConfirmedCommission: Total value of confirmed commission in this result.
  • transactionPendingCommission: Total value of pending commission in this result.
  • transactionPaidCommission: Total value of paid commission in this result.
  • transactionDeclinedCommission: Total value of declined commission in this result.

Parameters to filter data

Name Type Description
groupBy Integer Optional parameter, only send if you want to group all the transactions by date, affiliateNetwork or/and merchant. To get this field working, you have to set it to a string representing a comma-sepparated list of words. The values that can contain are:
  • date:To group the values by date (daily values)
  • affiliateNetwork:To group the values by affiliateNetwork.
  • merchant:To group the values by merchant
These words are not exclusive. For example, you can group by date and affiliateNetwork.
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.
* The maximum data range is 30 days. If you only set the dateFrom parameter, it has to be one date within the last 30 days.
merchantId Integer Return only overviews associated with the given merchantId. By default all merchants are returned.
affiliateNetworkId Integer Return only results 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.