question

Upvotes
Accepted
1 1 3 6

how do I request ESG data from java

I have got my session token (RDP Token), is any java sample to request ESG data e.g. https://api.refinitiv.com/data/environmental-social-governance/v1/views/basic?universe=IBM.N


StringBuilder url = new StringBuilder("https://api.refinitiv.com/data/environmental-social-governance/v1/views/basic?universe=IBM.N");

HttpGet request = new HttpGet(url.toString());

request.addHeader("Authorization", "Bearer " + sessionToken);

CloseableHttpClient httpClient = HttpClients.createDefault();

CloseableHttpResponse httpResponse = httpClient.execute(request);

BufferedReader reader = new BufferedReader(new InputStreamReader(

httpResponse.getEntity().getContent()));

String inputLine;

StringBuffer response = new StringBuffer();

while ((inputLine = reader.readLine()) != null) {

response.append(inputLine);

}

System.out.println(response.toString());

httpClient.close();


{"error":{"id":"107c01c3-fbfb-4217-8169-dadb2439b61d","code":"insufficient_scope","message":"access denied. Scopes required to access the resource: [trapi.data.esg.views-basic.read]. Missing scopes: [trapi.data.esg.views-basic.read]","status":"Forbidden"}}


This is my code, but I got above error

Any ideas?

rdp-apirefinitiv-data-platformjavaesg
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
17k 80 39 63

Hi @bin0

The above error "insufficient_scope" usually indicates that you do not have a license for the specified endpoint data - in your case ESG. As a test, you can try to retrieve ESG data from the API Playground based on the user ID you were provided in your Welcome email.

I would recommend you contact your Refinitiv account manager to confirm whether a license to retrieve ESG has been set up.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 1 3 6

Hi

Thanks, I tried same machine ID, password and client ID by useing postman, and python sample, I got same error code, insufficient_scope.

One question for the client ID. I use the apikey portal to generate the appKey. Do you know which account I should log in to generate the App Key, my machine ID account or my developer account. I tried to use my machineID and machine ID password but I cannot log in appkey generation portal, so I use developer account to generate appKey. is that correct.key.jpg


key.jpg (57.5 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
14k 30 5 10

hi @bin0

Yes, it's correct. The machine ID account cannot be used to login to generate the appkey, but the developer account can.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.