Games REST API - 401 server errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BlackRopeCloth
    Junior Member
    • Sep 2013
    • 1

    #1

    Games REST API - 401 server errors

    Hello!

    I've just started working with the REST Games API using Java, and Im having some trouble with successfully calling the "ping" API call (to log in and make sure it's working):

    This is the code I have so far (I've cut it down for ease of reading):

    Code:
    URL url = new URL("https://api.games.betfair.com/rest/v1/ping?username=exampleUsername");
    
    HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
    
    connection.setRequestProperty("gamexAPIPassword", "examplePassword");
    connection.addRequestProperty("gamexAPIAgent", "exampleGamesApp.1.0");
    connection.addRequestProperty("gamexAPIAgentInstance", constructMD5Hash()); 
    
    
    
    BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String input;
     
    while ((input = br.readLine()) != null) {
    System.out.println(input);
    }
    br.close();
    The code seems to work. It creates the MD5 hash string, and then sends this all off with the URL with the my actual username and password but it just keeps returning 401 errors from the server, saying that the username/password/user agent is wrong.

    Any ideas on how to solve this?

    Thanks in advance
Working...
X