Difference between revisions of "Offerit REST API Get Profit Loss Report"
From Offerit
OfferitDave (talk | contribs) (Created page with "{{Offerit Manual | show_api_admin_section = true }} == '''GET /report/profitloss''' == '''Description''' *Offerit supports an API resource to grab all the stats used within...") |
Offeritnick (talk | contribs) (→Parameters) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Offerit Manual | {{Offerit Manual | ||
− | | | + | | show_rest_api_section = true |
}} | }} | ||
== '''GET /report/profitloss''' == | == '''GET /report/profitloss''' == | ||
'''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 profit and loss report. |
'''Resource URL''' | '''Resource URL''' | ||
*<nowiki>http://domain/api/service/profitloss</nowiki> | *<nowiki>http://domain/api/service/profitloss</nowiki> | ||
− | *Replace domain with the | + | *Replace domain with the Offerit domain |
'''[[Offerit_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']] | '''[[Offerit_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']] | ||
Line 35: | Line 35: | ||
** '''demographic''' | ** '''demographic''' | ||
** '''refurl''' | ** '''refurl''' | ||
+ | ** '''device_type''' | ||
+ | ** '''device_brand''' | ||
+ | ** '''device_model''' | ||
+ | ** '''device_os''' | ||
+ | ** '''device_os_version''' | ||
+ | ** '''device_carrier''' | ||
+ | ** '''device_browser''' | ||
* '''params''' - Parameters for the report. An array that may contain: | * '''params''' - Parameters for the report. An array that may contain: | ||
− | ** '''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 49: | Line 56: | ||
** '''filter_programid''' - Only see stats for the specific program 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. | ** '''filter_countryid''' - Only see stats for the specific Country ID passed in. | ||
− | ** '''productcode''' - Breakdown the | + | ** '''productcode''' - Breakdown the Offerit code and only view stats associated with the Offerit code. |
** '''limit_inhouse''' - 0 for all affiliates, 1 for only inhouse, 2 to exclude inhouse. | ** '''limit_inhouse''' - 0 for all affiliates, 1 for only inhouse, 2 to exclude inhouse. | ||
** '''limit_mediabuy''' - 0 for all affiliates, 1 for only media buys, 2 to exclude media buys. | ** '''limit_mediabuy''' - 0 for all affiliates, 1 for only media buys, 2 to exclude media buys. | ||
Line 108: | Line 115: | ||
$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); |
Latest revision as of 10:22, 22 August 2018
GET /report/profitloss
Description
- Offerit supports an API resource to grab all the stats used within the Offerit profit and loss report.
Resource URL
- http://domain/api/service/profitloss
- Replace domain with the Offerit domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
- view - The breakdown of the report to display. Possible options are:
- period
- month
- year
- offer_group
- landing_page
- offer
- subid1
- subid2
- login
- adtool
- demographic
- refurl
- device_type
- device_brand
- device_model
- device_os
- device_os_version
- device_carrier
- device_browser
- params - Parameters for the report. An array that may contain:
- 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
- acct_rep - View the profit and loss report as an account rep. Will only see stats for affiliates assigned to the account rep
- 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.
- productcode - Breakdown the Offerit code and only view stats associated with the Offerit code.
- limit_inhouse - 0 for all affiliates, 1 for only inhouse, 2 to exclude inhouse.
- limit_mediabuy - 0 for all affiliates, 1 for only media buys, 2 to exclude media buys.
- filter_device_type - 0 for desktop, 1 for mobile, unset for all types.
- filter_device_brand_id - Device Brand ID.
- filter_device_model_id - Device Model ID.
- filter_device_os_id - Operating System ID.
- filter_device_browser_id - Browser ID.
- filter_device_carrier_id - IP/Carrier.
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( 'view' => 'year', 'start' => '2006-06-06', 'end' => 2015-03-14 ); $data_string = http_build_query($data); $url = 'http://domain/api/report/profitloss?'.$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); ?>