0
我試圖讓我的訪問令牌使用Yelp Fusion API。我試着在下面做出下面的POST請求,但不斷收到404錯誤。這是我第一次嘗試發佈POST請求,所以我不確定我是否做得對。Yelp Fusion POST請求
我已經安裝有不同於YELP這裏的說明:提前https://www.yelp.com/developers/documentation/v3/authentication
感謝。
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();
}
}
您好,感謝答覆。我試圖改變網址,但現在我得到一個400錯誤代碼。有關如何解決它的任何建議? – Chris
請參閱https://stackoverflow.com/questions/33713414/bad-request-from-yelp-api – user7294900