Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Get Analytics report from java

Avatar

Level 7

Hello Team,

 

Anyone tried to call the Analytics 2.0 API from java application?

https://github.com/AdobeDocs/analytics-2.0-apis/blob/master/reporting-guide.md

I tried this website. Now, I am able to hit this API from postman by passing all the necessary information.

 https://analytics.adobe.io/api/{COMPANYID}/reports

 But, when I tried to hit the API from java, I am getting only 400 response. No, other information.

 

Can someone provide me some information?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi, 


If you were able to make the call from Postman there is no reason why you should not be able to call the API from Java. You just need to make sure to include all the required headers as part of the http request. 

Headers:

'Accept: application/json'
'Authorization: Bearer {ACCESSTOKEN}'
'Content-Type: application/json'
'x-api-key: {APIKEY}'
'x-proxy-global-company-id: {COMPANYID}'

Additionally, according to the documentation https://adobedocs.github.io/analytics-2.0-apis/#/Reports/runReport  if you get a 400 error might be related to: 

EstebanBustamante_0-1708092702573.png

 

Hope this helps



Esteban Bustamante

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi, 


If you were able to make the call from Postman there is no reason why you should not be able to call the API from Java. You just need to make sure to include all the required headers as part of the http request. 

Headers:

'Accept: application/json'
'Authorization: Bearer {ACCESSTOKEN}'
'Content-Type: application/json'
'x-api-key: {APIKEY}'
'x-proxy-global-company-id: {COMPANYID}'

Additionally, according to the documentation https://adobedocs.github.io/analytics-2.0-apis/#/Reports/runReport  if you get a 400 error might be related to: 

EstebanBustamante_0-1708092702573.png

 

Hope this helps



Esteban Bustamante

Avatar

Level 7

Hi @EstebanBustamante 

 

Thanks for your reply. My bad. input was not proper. There was some syntax issue. Earlier I was not able to get the error. Now, I was getting the error message. Fixed the issue. 

 

- Thanks