Set up attribute using compund audience selector return error.

I'm trying to set up one argument for a few channels.

POST: https://go.urbanairship.com/api/channels/attributes 
Payload:

{
"audience": {
"OR": [
{"ios_channel": [
"Channel_id_for_iOS_device_1",
"Channel_id_for_iOS_device_1"
]},
{"android_channel": [
"Channel_id_for_android_device_1",
"Channel_id_for_android_device_2",
"Channel_id_for_android_device_3"
]}
]
},
"attributes": [
{
"action": "set",
"key": "test",
"value": "Test"
}
]
}

The response is:

{
"ok": false,
"error": "Could not parse request body.",
"error_code": 40000,
"details": {
"error": "Error parsing JSON at line: 3, column: 13",
"location": {
"line": 3,
"column": 13
}
}
}

If I use only ios_channel or android_channel it works:

{
"audience": {
"android_channel": [
"Channel_id_for_android_device_1",
"Channel_id_for_android_device_2",
"Channel_id_for_android_device_3"
]
},
"attributes": [
{
"action": "set",
"key": "test",
"value": "Test"
}
]
}

Didn't find what you were looking for?

New post

Comments

2 comments

  • Hi d.pirvulescu,

    Thanks for reaching out to Airship Technical Support! Could you please share the use case for this api call? Anything in particular that you are trying to achieve?
    We checked internally, and something like the below mentioned api request should work for you, in case you are trying to set certain attributes for a list of iOS and Android channel id's.

    {
    "audience": {
    "ios_channel": ["Channel_id_for_iOS_device_1", "Channel_id_for_iOS_device_2"],
    "android_channel": ["Channel_id_for_Android_device_1", "Channel_id_for_Android_device_2"]
    },
    "attributes": [
    {
    "action": "set",
    "key": "major_league",
    "value": "sf_giants"
    },
    {
    "action": "set",
    "key": "position",
    "value": "LF"
    }
    ]
    }
    Comment actions Permalink
  • Hi Arushi,

    I'm trying to update attributes for a user who theoretically could have multiple channels ios or android. 

    The solution proposed by you works. 

    Thanks.

    Comment actions Permalink
    0

Please sign in to leave a comment.