Java Example

package com.tradier.webservice.client;


import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;

public class GETClient {
    public static void main(String[] args) throws ClientProtocolException, IOException {
        BufferedReader responseBody = null;
        HttpClient client = HttpClientBuilder.create().build();

        try {
            //Define a HttpGet request
            HttpGet request = new HttpGet("");

            //Set Http Headers
            request.addHeader("Accept" , "application/xml");
            request.addHeader("Authorization", "Bearer YOUR_ACCESS_TOKEN");

            //Invoke the service
            HttpResponse response = client.execute(request);

            //Verify if the response is valid
            int statusCode = response.getStatusLine().getStatusCode();
            if(statusCode!=200) {
                throw new RuntimeException("Failed with HTTP error code : " + statusCode);
            } else {
                //If valid, get the response
                responseBody = new BufferedReader (new InputStreamReader(response.getEntity().getContent()));
                String line = "";
                while ((line = responseBody.readLine()) != null) {
        catch(Exception e) {
        } finally {

Tradier Inc. and its corresponding technology services (including API services) are distinct and separate from the services provided by Tradier Brokerage Inc. For more information regarding the services of Tradier, Inc., please contact For more information regarding the services of Tradier Brokerage, Inc. please contact Tradier Brokerage Inc. Member FINRA/SIPC

© 2019 Tradier Inc.
  • 11016 Rushmore Drive, Suite 350
  • Charlotte, NC 28277

All materials contained on this site and specifically the API documentation pages are protected by United States copyright law and may not be copied, reproduced, distributed, transmitted, displayed, published or broadcast without the prior written permission of Tradier Inc. The Structure, Format, Layout, Examples and Design of the pages are owned by Tradier Inc, and any efforts to willfully or accidently duplicate a whole or part of the pages on this site is a violation of United States copyright law.