This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
cdr_api [2014/06/12 23:26] ybarajas [Example] |
cdr_api [2014/06/25 17:01] (current) ybarajas [Example] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======CDR REST Interface====== | ||
+ | |||
+ | <note important>This call requires cookies from a Login API call. Please refer to the [[:api_login|How to Log In]] help page for more information.</note> | ||
+ | |||
+ | The Call Detail Records (CDR) report features several different key pieces of information such as: Transaction ID, Billing code, User ID, Authentication Domain, etc. For more details on the fields contained within monthly and daily CDR reports, please visit our [[call_detail_records|Call Detail Records]] help page. | ||
+ | |||
+ | |||
+ | =====Prerequisites===== | ||
+ | |||
+ | You need to create (or have access to) a user with the Bill Viewer role (and for child accounts, the user will need the Delegated Bill Viewer role). You can confirm that a user has the appropriate roles by logging into the Open Mobile Portal as this user and downloading the appropriate reports. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | =====Passwords with Special Characters===== | ||
+ | |||
+ | Special characters in passwords will have to be converted to URL-encoding in order to work with these scripts. | ||
+ | |||
+ | ^ ASCII ^ URL-encoding ^ | ||
+ | |(space)|%20| | ||
+ | |!|%21| | ||
+ | |"|%22| | ||
+ | |#|%23| | ||
+ | |$|%24| | ||
+ | |%|%25| | ||
+ | |&|%26| | ||
+ | |'|%27| | ||
+ | |(|%28| | ||
+ | |)|%29| | ||
+ | |*|%2A| | ||
+ | |+|%2B| | ||
+ | |,|%2C| | ||
+ | |-|%2D| | ||
+ | |.|%2E| | ||
+ | |/|%2F| | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ======Download Monthly (regular or adjusted) CDRs====== | ||
+ | |||
+ | ==Resource URL== | ||
+ | |||
+ | <code> | ||
+ | /moservices/rest/api/ipass/{COMPANY_ID}/mo/cdrReports/monthly/{CDR_TYPE}?User-Agent=apiuser&month={MONTH} | ||
+ | </code> | ||
+ | |||
+ | ==HTTP GET== | ||
+ | |||
+ | Return the monthly CDR report in a file. | ||
+ | |||
+ | ==GET Parameters== | ||
+ | |||
+ | Required parameters: | ||
+ | |||
+ | ^ Parameter ^ Description ^ | ||
+ | |COMPANY_ID| N/A| | ||
+ | |CDR_TYPE|The type of CDR report to download, i.e. //cdr// for regular CDR report, or //adjcdr// for adjusted CDR report.| | ||
+ | |Month|**Format:** YYYY-MM| | ||
+ | |User-Agent|This helps us route your API call appropriately. **Default:** //apiuser//| | ||
+ | |||
+ | =====Example===== | ||
+ | |||
+ | Download monthly CDR for the month of Jan of 2014 for Acme Company with Company ID 987654. | ||
+ | |||
+ | ==cURL:== | ||
+ | |||
+ | <code> | ||
+ | curl -k --request GET -b tmpCookies.txt -o $month.csv "https://openmobile.ipass.com/moservices/rest/api/ipass/$COMPANY/mo/cdrReports/monthly/cdr?User-Agent=apiuser&month=$month" | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ==JAVA:== | ||
+ | |||
+ | <code> | ||
+ | String reportURI = | ||
+ | "/moservices/rest/api/ipass/987654/mo/cdrReports/monthly/cdr?User-Agent=apiuser&month=2014-01”; | ||
+ | | ||
+ | HttpGet reportGet = new HttpGet("https://openmobile.ipass.com" + reportURI); | ||
+ | |||
+ | // Make the Monthly CDR API call to obtain the Monthly CDR report | ||
+ | HttpResponse reportGetResponse = httpClient.execute(reportGet); | ||
+ | HttpEntity httpEntity = reportGetResponse.getEntity(); | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ======Download Daily (regular or adjusted) CDRs====== | ||
+ | |||
+ | ==Resource URL== | ||
+ | |||
+ | <code> | ||
+ | /moservices/rest/api/ipass/{COMPANY_ID}/mo/cdrReports/daily/cdrdaily?User-Agent=apiuser&date={DATE} | ||
+ | </code> | ||
+ | |||
+ | ==HTTP GET== | ||
+ | |||
+ | Return the daily CDR report in a file. | ||
+ | |||
+ | ==GET Parameters== | ||
+ | |||
+ | Required parameters: | ||
+ | |||
+ | ^ Parameter ^ Description ^ | ||
+ | |COMPANY_ID|N/A| | ||
+ | |CDR_TYPE|The type of CDR report to download, i.e. //cdrdaily// for regular daily CDR report, or adjcdrdaily for adjusted daily CDR report.| | ||
+ | |DATE|**Format:** YYYY-MM-DD| | ||
+ | |User-Agent| This helps us route your API call appropriately. **Default:** //apiuser//| | ||
+ | |||
+ | =====Example===== | ||
+ | |||
+ | Download adjusted daily CDR for the date of Jan 21st of 2014 for Acme Company with Company ID 987654. | ||
+ | |||
+ | ==cURL:== | ||
+ | |||
+ | <code> | ||
+ | curl -k --request GET -b tmpCookies.txt -o $date.csv "https://openmobile.ipass.com/moservices/rest/api/ipass/$COMPANY/mo/cdrReports/daily/cdrdaily?User-Agent=apiuser&date=$date" | ||
+ | </code> | ||
+ | |||
+ | ==JAVA:== | ||
+ | |||
+ | <code> | ||
+ | // Prepare the Network & Client Users Report API call with the appropriate parameter | ||
+ | |||
+ | String reportURI = | ||
+ | "/moservices/rest/api/ipass/987654/mo/cdrReports/daily/cdrdaily?User-Agent=apiuser&date=2014-01-24”; | ||
+ | HttpGet reportGet = new HttpGet("https://openmobile.ipass.com" + reportURI); | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Go to: **[[:api_documentation|REST API Overview]] > [[:reports_rest|Introduction]]** | ||
+ | |||