package com.tradier.webservice.client; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; 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("https://api.tradier.com/v1/user/profile"); //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) { System.out.println(line); } } } catch(Exception e) { e.printStackTrace(); } finally { if(responseBody!=null) responseBody.close(); } } } Overview Welcome Endpoints Response Format Rate Limiting Streaming Trade Link Libraries Authentication Getting Started Obtain an Authorization Code Obtain an Access Token User Data Get user's profile Get a user's balances Get a user's positions Get a user's history Get a user's cost basis Get a user's orders Account Data Get an account's balances Get an account's positions Get an account's history Get an account's cost basis Get an account's orders Get a specific order's status Trading Getting Started Create an order Create a multileg order Preview an order Change an order Cancel an order