question

Upvotes
Accepted
1 0 0 3

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

javapermid-apiintelligent-tagging-apiopen-permid-api
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.

1 Answer

Upvotes
Accepted
52.7k 135 44 63

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 512.0 KiB each and 1.0 MiB total.