question

Upvotes
Accepted
1 0 0 0

如何用java获取ESG数据?

我已经得到了的会话令牌(RDP Token), 请问是否有java请求ESG数据的代码实例 ?

比如希望获取下面的数据

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]。缺少作用域。[trapi.data.esg.views-basic.read]", "status": "Forbidden"}}.

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.

Upvotes
Accepted
15.2k 40 12 19

Hi @willson.wang,

This error means, that your account is not permissioned for accessing ESG data. Please speak with the Refinitiv account manager to get it added to your RDP ID.

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 0 0 0

"insufficient_scope" 通常表示你没有指定终端数据的许可证

你可以尝试根据你在欢迎邮件中提供的用户ID,从API Playground检索ESG数据。

建议你联系你的Refinitiv客户经理,以确认是否已经设置了检索ESG的许可证。

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
15.2k 40 12 19

@willson.wang,

Please refrain from posting duplicate questions to the forum.

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.