0

I'm trying to get my access token for using the Yelp Fusion API. I've tried to make the following POST request below but keep getting a 404 Error. This is my first time trying to make a POST request so I'm not sure if I am doing it right.

I've attached the instructions from YELP here: https://www.yelp.com/developers/documentation/v3/authentication

Thanks in advance.

public static final String YELPURL = "https://api.yelp.com/oauth/token";
public static void main(String[] args) {
    try {
        URL obj = new URL(YELPURL);
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("grant_type", "client_credentials");
        con.setRequestProperty("client_id", CLIENTID);
        con.setRequestProperty("client_secret", CLIENTSECRET);
        con.setDoOutput(true);
        int responseCode = con.getResponseCode();
        System.out.println("Response Code: " + responseCode);   
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
Chris
  • 1

1 Answers1

0

Re read the link you send

You should send to https://api.yelp.com/oauth2/token

instead of https://api.yelp.com/oauth/token

Ori Marko
  • 56,308
  • 23
  • 131
  • 233