java - 更新 APIGEE 实体时出错

标签 java android asynchronous android-asynctask apigee

我目前正在开发一个实现 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/

相关文章:

java - 格式化小数的长度

android - gradlew build 在 mergeDebugResources 卡住

javascript - 如何从异步调用返回响应?

java - 如何从 Eclipse 以 super 用户身份运行我的应用程序?

java - Opencv调整矩形大小同时保持质心

java - Java中多维数组的使用

c# - AsyncPostBackTrigger Gridview 分页

android - 使用Android二进制文件使用openCV Matrix裁剪图像

java - 如何以有序的方式创建 Json 对象?

java - Java 应用服务器中的 CompletableFuture/parallel Stream