UrbanAirship: Error setting tags on namedUser

489 views Asked by At

Following the instructions on UrbanAirship documentation, I need to add a TagGroup to a namedUser with this lines of code on a demo App in Android

airship.getPushManager().getNamedUser().setId("123456");
airship.getPushManager().getNamedUser().editTagGroups().addTag("loyalty", "elite").apply();

But, the LogCat shows this error:

D/UrbanAirshipDemo - UALib﹕ Received a response for tag groups: Response: ResponseBody:  ResponseHeaders: {null=[HTTP/1.1 400 Bad Request], Connection=[close, Transfer-Encoding], Content-Type=[application/vnd.urbanairship+json; version=3], Date=[Wed, 24 Jun 2015 20:02:06 GMT], Transfer-Encoding=[chunked], X-Android-Received-Millis=[1435176126629], X-Android-Response-Source=[NETWORK 400], X-Android-Sent-Millis=[1435176126427]} ResponseMessage: Bad Request Status: 400
E/UrbanAirshipDemo - UALib﹕ Update tag groups failed with status: 400
E/UrbanAirshipDemo - UALib﹕ Both add & remove fields are present and the intersection of the tags in these fields is not empty.

Is it something weird on their API? Instructions from here: http://docs.urbanairship.com/platform/android.html#named-user-tag-groups

Is just simple the implementation, but their API is returning 400. Push notifications are working fine

1

There are 1 answers

1
ralepinski On BEST ANSWER

I was able to reproduce the same issue. The error message is incorrect, the real issue is the tag group does not exists yet. Groups can only be created through Go. Try creating the group following - http://docs.urbanairship.com/topic-guides/tag-groups-walkthrough.html#create-a-tag-group and try again.

The error message will be fixed in a future release.