1
我正嘗試在Java客戶端上使用REST API在SFDC中創建用戶。 請在下面看到我的代碼,並幫助我瞭解爲什麼我收到以下錯誤信息:如何使用REST API創建SalesForce'用戶'?
HTTP Status 400 ::
{
errorCode: "NOT_FOUND"
message: "The requested resource does not exist"
}
CODE:
HttpClient httpClient = new HttpClient();
JSONObject user = new JSONObject();
String userId = null;
try{
user.put("Username", "[email protected]");
user.put("Alias", "DemoAPI");
user.put("ProfileId", "00e90000000fKXB");
user.put("Email", "[email protected]");
user.put("EmailEncodingKey", "ISO-8859-1");
user.put("LastName", "REST API Test");
user.put("LanguageLocaleKey", "pt_BR");
user.put("LocaleSidKey", "pt_BR");
user.put("TimeZoneSidKey", "America/Sao_Paulo");
PostMethod post = new PostMethod(instanceURL + "/services/data/v29.0/sobjects/User");
post.setRequestHeader("Authorization", "OAuth " + accessToken);
post.setRequestEntity(new StringRequestEntity(user.toString(), "application/json", null));
httpClient.executeMethod(post);
}catch(Exception e){}
也許您的帳戶無權訪問用戶對象? – superfell