我目前正在开发一个实现 apigee 的应用程序,但是,我在尝试更新实体时遇到了一个问题。以下是我目前正在使用的方法。
Map<String, Object> updatedEntity = new HashMap<String, Object>();
ArrayList<Map<String,Object>> subPropertyArray = new ArrayList<Map<String,Object>>();
Map<String, Object> subProperty = new HashMap<String, Object>();
subProperty.put("age", "");
subProperty.put("auto_checkin_times", auto_checkin_times);
subProperty.put("auto_checkins_enabled", "on");
subProperty.put("bio", "");
subProperty.put("max_age", "999");
subProperty.put("min_age","18");
subProperty.put("dob", mDob);
subProperty.put("locale","");
subProperty.put("sex", mGender);
subProperty.put("sexual_preference", mSexualPreference);
subProperty.put("utc_offset","");
subPropertyArray.add(subProperty);
updatedEntity.put("type", "user");
updatedEntity.put("info", subPropertyArray);
dataClient.updateEntityAsync(entityID, updatedEntity, new ApiResponseCallback() {
@Override
public void onResponse(ApiResponse apiResponse) {
if (apiResponse != null) {
Intent intent = new Intent(SetupPage.this, HomePage.class);
startActivity(intent);
}
}
@Override
public void onException(Exception e) {
Log.e("", e.toString());
}
});
但是我收到以下错误:
“错误 PUT 到 ' https://api.usergrid.com/ ORGNAME/APPNAME/user/USERID”
接着是:
“未找到身份验证挑战”
“doHttpRequest 返回空值”
如有任何帮助,我们将不胜感激。 谢谢
最佳答案
您是否在请求中发送 token ? “未找到身份验证挑战”错误让我认为您可能将 token 传递给不需要它的端点(例如默认沙盒应用程序),或者在请求中传递无效 token 。
关于java - 更新 APIGEE 实体时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25399676/