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