Does anyone have an example of calling the api.thomsonreuters.com/permid/match API in Java. I nee...

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

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    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>