5

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

Andy Joyce
  • 2,722
  • 3
  • 12
  • 24

2 Answers2

0

Are you sending a token with your request? The "No authentication challenges found" errors makes me think you could be either passing a token to an endpoint that doesn't require it (e.g. the default sandbox app), or passing an invalid token with the request.

amuramoto
  • 21
  • 2
0

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.

Andy Joyce
  • 2,722
  • 3
  • 12
  • 24