question

Upvotes
Accepted
1 0 0 2

Does anyone have an example of calling the api.thomsonreuters.com/permid/match API in Java. I need the format for the text only call. Not documented

javaintelligent-tagging-apipermid-apiopen-permid-api
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
38.1k 71 35 53

The code in Java looks like:

        CloseableHttpClient httpclient = HttpClientBuilder.create().disableContentCompression().build();
        String urlHost = "https://api.thomsonreuters.com";
        HttpPost httppost = new HttpPost(urlHost + "/permid/match");
        
        httppost.addHeader("x-ag-access-token", "<token>");
        httppost.addHeader("x-openmatch-dataType","Organization");
        httppost.addHeader("Content-Type","text/plain" );
        String body="LocalID,Standard Identifier,Name,Country,Street,City,PostalCode,State,Website\r\n1,RIC:AAPL.O|Ticker:AAPL,Apple,US,\"Apple Campus, 1 Infinite Loop\",Cupertino,95014,California,";
        try {
        	StringEntity requestBody = new StringEntity(body);
        	httppost.setEntity(requestBody);
        	ResponseHandler<String> responseHandler = new BasicResponseHandler();
        	String response = httpclient.execute(httppost, responseHandler);
			System.out.println(response);
		} catch (ClientProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        

Set the value of x-ag-access-token to your token. The format of text in the body is available at https://permid.org/match.

The code uses org.apache.httpcomponents for HTTP post request.

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.8</version>
</dependency>
icon clock
10 |1500

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

Click below to post an Idea Post Idea