Skip to content

Commit 7025df5

Browse files
authored
Merge pull request #102 from urbanairship/TOOLSLIBS-621-tag-lists-docs
[TOOLSLIBS-621] Adds tag list docs
2 parents 188e853 + 5bba468 commit 7025df5

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Contents:
6666
named_user.rst
6767
reports.rst
6868
static_lists.rst
69+
tag_lists.rst
6970
exceptions.rst
7071
examples.rst
7172
create_and_send.rst

docs/tag_lists.rst

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

Comments
 (0)