{"__v":0,"_id":"57aba3b4b5c9591700b877ea","category":{"__v":0,"_id":"56708ce43a32d20d00c45cbf","pages":[],"project":"5429beef1163360800ed31fa","version":"5429beef1163360800ed31fd","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-12-15T21:57:56.034Z","from_sync":false,"order":6,"slug":"reporting","title":"Data & Reports"},"parentDoc":null,"project":"5429beef1163360800ed31fa","user":"56157c37c41bfc0d00292b38","version":{"__v":20,"_id":"5429beef1163360800ed31fd","project":"5429beef1163360800ed31fa","createdAt":"2014-09-29T20:19:59.904Z","releaseDate":"2014-09-29T20:19:59.904Z","categories":["5429beef1163360800ed31fe","55e74e1f5d36b32b002563fa","55e7500a73169617001f2e86","55e76b8196131b2f00bf4b72","55e89569cdbb8a350096df9c","55f8935eb089b71700a8364e","55f8a67d3bb4bb0d0022d093","55f9dbefc7ef770d00d9bf6d","5601c21a22ecf60d002b27b3","5601c21ff12aee0d001bb06e","5601c2256c7b610d00280db5","5601c22c22ecf60d002b27b4","5603738d0c78b00d0039af47","5626f70bfcbbc621004ebf52","566f7a1ae144ab0d00e9732f","566f85ca7820960d00c3b93d","56708ce43a32d20d00c45cbf","56708d436995210d003aad8e","5736471abe10a9200030732c","57a82c7aff9bd30e00a6f1c1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-10T21:59:16.584Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"examples":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":7,"body":"AdsNative provides a set of Console API endpoints to retrieve reporting data of an organization.\n\n**OAuth 2**\n\nTo get access to the reporting API, you must authenticate your API request using the OAuth 2 protocol, you can find out more at http://oauth.net.\n\n**Access Tokens**\n\nIf you are already familiar OAuth, you can get started by retrieving your **Client ID** and **Client Secret** on the [Settings](https://console.adsnative.com/settings/#api-client) page.\n\nMake a POST request to:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST -d \\\"grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET\\\" \\\\\\n  https://console.adsnative.com/api/v1/oauth/token/\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nOnce granted access by your account executive, you can get the Client ID and Client Secret from your organization’s account settings page.\n\n**Making API Calls**\n\nWith a valid access token, your app can make calls to the reporting API endpoints by sending the access token as a “Bearer” token in the “Authorization” request header.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Authorization: Bearer aBcdeFgHiJK\\\" \\\\\\nhttps://console.adsnative.com/api/v2/report/campaign/?start_date=2016-01-01&end_date=2016-01-02\\n\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nNow that you're able to successfully authenticate and access the console API, you can follow instructions in the [Reporting API](http://dev.adsnative.com/v1.0/docs/reporting-api-v2) page to access your data programmatically.","excerpt":"","slug":"console-api-authentication","type":"basic","title":"Console API Authentication"}

Console API Authentication


AdsNative provides a set of Console API endpoints to retrieve reporting data of an organization. **OAuth 2** To get access to the reporting API, you must authenticate your API request using the OAuth 2 protocol, you can find out more at http://oauth.net. **Access Tokens** If you are already familiar OAuth, you can get started by retrieving your **Client ID** and **Client Secret** on the [Settings](https://console.adsnative.com/settings/#api-client) page. Make a POST request to: [block:code] { "codes": [ { "code": "curl -X POST -d \"grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET\" \\\n https://console.adsnative.com/api/v1/oauth/token/", "language": "curl" } ] } [/block] Once granted access by your account executive, you can get the Client ID and Client Secret from your organization’s account settings page. **Making API Calls** With a valid access token, your app can make calls to the reporting API endpoints by sending the access token as a “Bearer” token in the “Authorization” request header. [block:code] { "codes": [ { "code": "curl -H \"Authorization: Bearer aBcdeFgHiJK\" \\\nhttps://console.adsnative.com/api/v2/report/campaign/?start_date=2016-01-01&end_date=2016-01-02\n", "language": "curl" } ] } [/block] Now that you're able to successfully authenticate and access the console API, you can follow instructions in the [Reporting API](http://dev.adsnative.com/v1.0/docs/reporting-api-v2) page to access your data programmatically.