Difference between revisions of "Offerit REST API Get Transaction Report"
From Offerit
OfferitDave (talk | contribs) (→GET /report/transaction) |
OfferitRob (talk | contribs) (→Example Code) |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Offerit Manual | {{Offerit Manual | ||
− | | | + | | show_rest_api_section = true |
}} | }} | ||
== '''GET /report/transaction''' == | == '''GET /report/transaction''' == | ||
'''Description''' | '''Description''' | ||
− | *Offerit supports an API resource to grab all the stats used within the | + | *Offerit supports an API resource to grab all the stats used within the Offerit transactions report. |
'''Resource URL''' | '''Resource URL''' | ||
− | *<nowiki>http://domain/api | + | *<nowiki>http://domain/api/report/transaction</nowiki> |
*Replace domain with the offerit domain | *Replace domain with the offerit domain | ||
Line 23: | Line 23: | ||
== '''Parameters''' == | == '''Parameters''' == | ||
− | ** '''period''' - Which period of time to select data for. See below for more information regarding the periods within | + | ** '''period''' - Which period of time to select data for. See below for more information regarding the periods within Offerit. |
** '''start''' - start date for the stats. Used when period is not sent or set to 8 | ** '''start''' - start date for the stats. Used when period is not sent or set to 8 | ||
** '''end''' - end date for the stats. Used when period is not sent or set to 8 | ** '''end''' - end date for the stats. Used when period is not sent or set to 8 | ||
Line 38: | Line 38: | ||
** '''filter_external_clickid''' - search for a specific affiliate _ocid. | ** '''filter_external_clickid''' - search for a specific affiliate _ocid. | ||
** '''filter_transaction_hash''' - search for an internal click_hash. | ** '''filter_transaction_hash''' - search for an internal click_hash. | ||
+ | ** '''filter_orderid''' - search for a transaction with a specific orderid. | ||
** '''trans_start''' - Number of transactions to offset default 0. | ** '''trans_start''' - Number of transactions to offset default 0. | ||
** '''trans_count''' - Number of transactions to return default 100. | ** '''trans_count''' - Number of transactions to return default 100. | ||
Line 63: | Line 64: | ||
|- | |- | ||
| 8 || free || Freeform (See also the ''start'' and ''end'' parameters above) | | 8 || free || Freeform (See also the ''start'' and ''end'' parameters above) | ||
+ | <!-- | ||
+ | |- | ||
+ | | 10 || lastweek || Last Week | ||
+ | |- | ||
+ | | 11 || lastmonth || Last Month | ||
+ | |- | ||
+ | | 12 || past60 || Past 60 Days | ||
+ | |- | ||
+ | | 13 || past90 || Past 90 Days | ||
+ | |- | ||
+ | | 14 || lastyear || Last Year | ||
+ | |- | ||
+ | | 15 || past7 || Past 7 Days | ||
+ | |- | ||
+ | | 16 || past180 || Past 180 Days | ||
+ | |- | ||
+ | | 17 || past30 || Past 30 Days | ||
+ | |- | ||
+ | | 28 || past15 || Past 15 Days | ||
+ | --> | ||
|} | |} | ||
Line 73: | Line 94: | ||
$data = array( | $data = array( | ||
− | + | 'filter_orderid' => 3890345, | |
− | + | 'period' => 7 | |
); | ); | ||
Line 89: | Line 110: | ||
$resp = curl_exec($curl); | $resp = curl_exec($curl); | ||
− | //dumps an associative array representation of the json | + | //dumps an associative array representation of the json response |
− | + | $output = json_decode($resp, true); | |
+ | if($output !== NULL) { | ||
+ | //json was valid. Dump the decoded array | ||
+ | print_r($output); | ||
+ | } | ||
+ | else { | ||
+ | //invalid json, just dump the raw response | ||
+ | print_r($resp); | ||
+ | } | ||
// Close request to clear up some resources | // Close request to clear up some resources | ||
curl_close($curl); | curl_close($curl); | ||
?> | ?> | ||
+ | </pre> | ||
+ | |||
+ | '''Response''' | ||
+ | <pre> | ||
+ | Array | ||
+ | ( | ||
+ | [16102840320319934329] => Array | ||
+ | ( | ||
+ | [time] => 1610284032 | ||
+ | [loginid] => 2 | ||
+ | [amount] => 0 | ||
+ | [trans_type] => advertiser_initial | ||
+ | [transaction_hash] => ac35ffba0fc0007.24591976 | ||
+ | [orderid] => 7861 | ||
+ | [external_clickid] => CLICK_198758_17 | ||
+ | [offerid] => 14 | ||
+ | [landing_pageid] => 26 | ||
+ | [total_payout] => 36 | ||
+ | [payouts] => Array | ||
+ | ( | ||
+ | [0] => Array | ||
+ | ( | ||
+ | [id] => 16102840331022602480 | ||
+ | [type] => referral | ||
+ | [username] => byers1998 | ||
+ | [loginid] => 109 | ||
+ | [amount] => 4 | ||
+ | ) | ||
+ | |||
+ | [1] => Array | ||
+ | ( | ||
+ | [id] => 20840330721619639764 | ||
+ | [type] => affiliate | ||
+ | [username] => Jeff | ||
+ | [loginid] => 37 | ||
+ | [amount] => 32 | ||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | ) | ||
+ | ) | ||
</pre> | </pre> | ||
Latest revision as of 19:19, 11 January 2021
GET /report/transaction
Description
- Offerit supports an API resource to grab all the stats used within the Offerit transactions report.
Resource URL
- http://domain/api/report/transaction
- Replace domain with the offerit domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
- period - Which period of time to select data for. See below for more information regarding the periods within Offerit.
- start - start date for the stats. Used when period is not sent or set to 8
- end - end date for the stats. Used when period is not sent or set to 8
- filter_affiliate - Only see stats for specific affiliate
- filter_loginid - Only see stats for the specifc login ID passed in.
- filter_campaignid - Only see stats for the specific campaign ID for the affiliate. (Can only be used if filter_loginid is passed in)
- filter_offerid - Only see stats for the specific site ID passed in.
- filter_landingpageid - Only see stats for the specific tour ID passed in.
- filter_adtoolid - Only see stats for the specific adtool ID passed in.
- filter_programid - Only see stats for the specific program ID passed in.
- filter_countryid - Only see stats for the specific Country ID passed in.
- no_inhouse - 0 for all affiliates, 1 to exclude inhouse.
- trans_type - Type of transactions to return. Default is all.
- filter_external_clickid - search for a specific affiliate _ocid.
- filter_transaction_hash - search for an internal click_hash.
- filter_orderid - search for a transaction with a specific orderid.
- trans_start - Number of transactions to offset default 0.
- trans_count - Number of transactions to return default 100.
Periods
# | Name | Argument Description |
---|---|---|
0 | current | Current Period |
1 | last | Last Period |
2 | today | Today |
3 | yesterday | Yesterday |
4 | week | This Week |
5 | month | This Month |
6 | year | This Year |
7 | all | All Time |
8 | free | Freeform (See also the start and end parameters above) |
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'filter_orderid' => 3890345, 'period' => 7 ); $data_string = http_build_query($data); $url = 'http://domain/api/report/transaction?'.$data_string; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: productsupport' ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_URL, $url); $resp = curl_exec($curl); //dumps an associative array representation of the json response $output = json_decode($resp, true); if($output !== NULL) { //json was valid. Dump the decoded array print_r($output); } else { //invalid json, just dump the raw response print_r($resp); } // Close request to clear up some resources curl_close($curl); ?>
Response
Array ( [16102840320319934329] => Array ( [time] => 1610284032 [loginid] => 2 [amount] => 0 [trans_type] => advertiser_initial [transaction_hash] => ac35ffba0fc0007.24591976 [orderid] => 7861 [external_clickid] => CLICK_198758_17 [offerid] => 14 [landing_pageid] => 26 [total_payout] => 36 [payouts] => Array ( [0] => Array ( [id] => 16102840331022602480 [type] => referral [username] => byers1998 [loginid] => 109 [amount] => 4 ) [1] => Array ( [id] => 20840330721619639764 [type] => affiliate [username] => Jeff [loginid] => 37 [amount] => 32 ) ) ) )