|
| 1 | +Tag Lists |
| 2 | +========= |
| 3 | + |
| 4 | +Bulk add and/or remove tags by uploading a CSV file of Airship users. For more |
| 5 | +information about the use of this endpoint, incluiding CSV file formatting requirements |
| 6 | +please see `the Airship Tag Lists API documentation |
| 7 | +<https://docs.airship.com/api/ua/#tag-tag-lists>`__ |
| 8 | + |
| 9 | + |
| 10 | +Create List |
| 11 | +----------- |
| 12 | + |
| 13 | +Add tags to your contacts by creating a list and uploading CSV file with user identifiers. |
| 14 | +The body of the request contains the name, description, and optional metadata for the |
| 15 | +list. After you define a list, you populate it with a call to the Upload Tag List method. |
| 16 | + |
| 17 | +.. code-block:: ruby |
| 18 | +
|
| 19 | + require 'urbanairship' |
| 20 | + UA = Urbanairship |
| 21 | + airship = UA::Client.new(key: 'app_key', secret: 'master_secret') |
| 22 | + tags = {'tag_group_name': ['tag1', 'tag2']} |
| 23 | +
|
| 24 | + tag_list = UA::TagList.new(client: airship) |
| 25 | + tag_list.name = 'ua_tags_list_name' |
| 26 | + tag_list.create(description: 'description', extra: {'key': 'value'}, add: tags) |
| 27 | +
|
| 28 | +
|
| 29 | +Upload List |
| 30 | +----------- |
| 31 | + |
| 32 | +Upload a CSV that will set tag values on the specified channels or named users. See `the |
| 33 | +Airship API documentation <https://docs.airship.com/api/ua/#operation-api-tag-lists-list_name-csv-put>`__ for CSV formatting requirements. Set |
| 34 | +the optional `gzip` parameter to `true` if your file is gzip compressed. |
| 35 | + |
| 36 | +.. code-block:: ruby |
| 37 | +
|
| 38 | + require 'urbanairship' |
| 39 | + UA = Urbanairship |
| 40 | + airship = UA::Client.new(key: 'app_key', secret: 'master_secret') |
| 41 | +
|
| 42 | + tag_list = UA::TagList.new(client: airship) |
| 43 | + tag_list.name = 'ua_tags_list_name' |
| 44 | + tag_list.upload(csv_file: 'file_content', gzip: true) |
| 45 | +
|
| 46 | +
|
| 47 | +Dowload List Errors |
| 48 | +------------------- |
| 49 | + |
| 50 | +During processing, after a list is uploaded, errors can occur. Depending on the type |
| 51 | +of list processing, an error file may be created, showing a user exactly what went wrong. |
| 52 | + |
| 53 | +.. code-block:: ruby |
| 54 | +
|
| 55 | + require 'urbanairship' |
| 56 | + UA = Urbanairship |
| 57 | + airship = UA::Client.new(key: 'app_key', secret: 'master_secret') |
| 58 | +
|
| 59 | + tag_list = UA::TagList.new(client: airship) |
| 60 | + error_csv = tag_list.errors |
| 61 | +
|
| 62 | +
|
| 63 | +Retrieve All Tag Lists |
| 64 | +---------------------- |
| 65 | + |
| 66 | +Retrieve information about all tag lists. This call returns a list of metadata that |
| 67 | +will not contain the actual lists of users. |
| 68 | + |
| 69 | +.. code-block:: ruby |
| 70 | +
|
| 71 | + require 'urbanairship' |
| 72 | + UA = Urbanairship |
| 73 | + airship = UA::Client.new(key: 'app_key', secret: 'master_secret') |
| 74 | +
|
| 75 | + tag_list = UA::TagList.new(client: airship) |
| 76 | + list_response = tag_list.list |
0 commit comments