Search code examples
javaandroidasynchronousandroid-asynctaskapigee

Error when updating APIGEE Entities


Im currently developing an application that implements apigee, however, i've come across an issue when trying to update entities. Below is the method i'm currently using.

            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());
                }
            });

However I'm getting the following error:

"Error PUT to 'https://api.usergrid.com/ORGNAME/APPNAME/user/USERID"

followed by:

"No authentication challenges found"

"doHttpRequest returned null"

Any assistance would be highly appreciated. Thanks


Solution

  • I should have replied got his earlier, however, the issue seemed to be down to a number of issues, the entityid was slightly wrong and the data I was posting wasn't correctly formatted.