onesignal 0.3.0 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +6 -1
- data/README.md +126 -111
- data/Rakefile +8 -8
- data/docs/App.md +76 -0
- data/docs/Button.md +22 -0
- data/docs/DefaultApi.md +1394 -0
- data/docs/DeliveryData.md +26 -0
- data/docs/ExportPlayersRequestBody.md +22 -0
- data/docs/Filter.md +24 -0
- data/docs/FilterExpressions.md +26 -0
- data/docs/FilterNotificationTarget.md +40 -0
- data/docs/GetNotificationRequestBody.md +22 -0
- data/docs/InlineResponse200.md +24 -0
- data/docs/InlineResponse2001.md +18 -0
- data/docs/InlineResponse2002.md +20 -0
- data/docs/InlineResponse2003.md +18 -0
- data/docs/InlineResponse2004.md +20 -0
- data/docs/InlineResponse2005.md +18 -0
- data/docs/InlineResponse201.md +20 -0
- data/docs/InlineResponse400.md +18 -0
- data/docs/InlineResponse4001.md +20 -0
- data/docs/InlineResponse4002.md +18 -0
- data/docs/InlineResponse409.md +20 -0
- data/docs/Notification.md +240 -0
- data/docs/NotificationAllOf.md +192 -0
- data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
- data/docs/NotificationSlice.md +24 -0
- data/docs/NotificationTarget.md +64 -0
- data/docs/Operator.md +18 -0
- data/docs/OutcomeData.md +22 -0
- data/docs/PlatformDeliveryData.md +28 -0
- data/docs/Player.md +70 -0
- data/docs/PlayerNotificationTarget.md +36 -0
- data/docs/PlayerSlice.md +24 -0
- data/docs/Purchase.md +22 -0
- data/docs/Segment.md +22 -0
- data/docs/SegmentNotificationTarget.md +20 -0
- data/docs/StringMap.md +102 -0
- data/docs/UpdatePlayerTagsRequestBody.md +18 -0
- data/git_push.sh +58 -0
- data/lib/OneSignal.rb +75 -0
- data/lib/onesignal/api/default_api.rb +1338 -0
- data/lib/onesignal/api_client.rb +391 -0
- data/lib/onesignal/api_error.rb +57 -0
- data/lib/onesignal/configuration.rb +242 -0
- data/lib/onesignal/models/app.rb +519 -13
- data/lib/onesignal/models/button.rb +241 -0
- data/lib/onesignal/models/delivery_data.rb +254 -0
- data/lib/onesignal/models/export_players_request_body.rb +241 -0
- data/lib/onesignal/models/filter.rb +293 -0
- data/lib/onesignal/models/filter_expressions.rb +335 -0
- data/lib/onesignal/models/filter_notification_target.rb +329 -0
- data/lib/onesignal/models/get_notification_request_body.rb +272 -0
- data/lib/onesignal/models/inline_response200.rb +256 -0
- data/lib/onesignal/models/inline_response2001.rb +218 -0
- data/lib/onesignal/models/inline_response2002.rb +227 -0
- data/lib/onesignal/models/inline_response2003.rb +218 -0
- data/lib/onesignal/models/inline_response2004.rb +227 -0
- data/lib/onesignal/models/inline_response2005.rb +218 -0
- data/lib/onesignal/models/inline_response201.rb +228 -0
- data/lib/onesignal/models/inline_response400.rb +220 -0
- data/lib/onesignal/models/inline_response4001.rb +229 -0
- data/lib/onesignal/models/inline_response4002.rb +220 -0
- data/lib/onesignal/models/inline_response409.rb +229 -0
- data/lib/onesignal/models/notification.rb +1395 -5
- data/lib/onesignal/models/notification_all_of.rb +1124 -0
- data/lib/onesignal/models/notification_all_of_android_background_layout.rb +240 -0
- data/lib/onesignal/models/notification_slice.rb +247 -0
- data/lib/onesignal/models/notification_target.rb +494 -0
- data/lib/onesignal/models/operator.rb +253 -0
- data/lib/onesignal/models/outcome_data.rb +285 -0
- data/lib/onesignal/models/platform_delivery_data.rb +264 -0
- data/lib/onesignal/models/player.rb +483 -9
- data/lib/onesignal/models/player_notification_target.rb +329 -0
- data/lib/onesignal/models/player_slice.rb +247 -0
- data/lib/onesignal/models/purchase.rb +254 -0
- data/lib/onesignal/models/segment.rb +251 -0
- data/lib/onesignal/models/segment_notification_target.rb +233 -0
- data/lib/onesignal/models/string_map.rb +644 -0
- data/lib/onesignal/models/update_player_tags_request_body.rb +219 -0
- data/lib/onesignal/version.rb +13 -1
- data/onesignal.gemspec +36 -27
- data/spec/api/default_api_spec.rb +285 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/app_spec.rb +212 -0
- data/spec/models/button_spec.rb +46 -0
- data/spec/models/delivery_data_spec.rb +58 -0
- data/spec/models/export_players_request_body_spec.rb +46 -0
- data/spec/models/filter_expressions_spec.rb +66 -0
- data/spec/models/filter_notification_target_spec.rb +100 -0
- data/spec/models/filter_spec.rb +56 -0
- data/spec/models/get_notification_request_body_spec.rb +50 -0
- data/spec/models/inline_response2001_spec.rb +34 -0
- data/spec/models/inline_response2002_spec.rb +40 -0
- data/spec/models/inline_response2003_spec.rb +34 -0
- data/spec/models/inline_response2004_spec.rb +40 -0
- data/spec/models/inline_response2005_spec.rb +34 -0
- data/spec/models/inline_response200_spec.rb +52 -0
- data/spec/models/inline_response201_spec.rb +40 -0
- data/spec/models/inline_response4001_spec.rb +40 -0
- data/spec/models/inline_response4002_spec.rb +34 -0
- data/spec/models/inline_response400_spec.rb +34 -0
- data/spec/models/inline_response409_spec.rb +40 -0
- data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
- data/spec/models/notification_all_of_spec.rb +560 -0
- data/spec/models/notification_slice_spec.rb +52 -0
- data/spec/models/notification_spec.rb +704 -0
- data/spec/models/notification_target_spec.rb +172 -0
- data/spec/models/operator_spec.rb +38 -0
- data/spec/models/outcome_data_spec.rb +50 -0
- data/spec/models/platform_delivery_data_spec.rb +64 -0
- data/spec/models/player_notification_target_spec.rb +88 -0
- data/spec/models/player_slice_spec.rb +52 -0
- data/spec/models/player_spec.rb +190 -0
- data/spec/models/purchase_spec.rb +46 -0
- data/spec/models/segment_notification_target_spec.rb +40 -0
- data/spec/models/segment_spec.rb +46 -0
- data/spec/models/string_map_spec.rb +286 -0
- data/spec/models/update_player_tags_request_body_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- metadata +182 -65
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -17
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -22
- data/CODE_OF_CONDUCT.md +0 -49
- data/LICENSE +0 -21
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/onesignal/app_id_missing_error.rb +0 -7
- data/lib/onesignal/client.rb +0 -44
- data/lib/onesignal/models/base_model.rb +0 -40
- data/lib/onesignal/request.rb +0 -94
- data/lib/onesignal/request_error.rb +0 -21
- data/lib/onesignal/resources/app_resource.rb +0 -27
- data/lib/onesignal/resources/base_resource.rb +0 -35
- data/lib/onesignal/resources/notification_resource.rb +0 -33
- data/lib/onesignal/resources/player_resource.rb +0 -53
- data/lib/onesignal.rb +0 -23
data/docs/DefaultApi.md
ADDED
@@ -0,0 +1,1394 @@
|
|
1
|
+
# OneSignal::DefaultApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://onesignal.com/api/v1*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**cancel_notification**](DefaultApi.md#cancel_notification) | **DELETE** /notifications/{notification_id} | Stop a scheduled or currently outgoing notification |
|
8
|
+
| [**create_app**](DefaultApi.md#create_app) | **POST** /apps | Create an app |
|
9
|
+
| [**create_notification**](DefaultApi.md#create_notification) | **POST** /notifications | Create notification |
|
10
|
+
| [**create_player**](DefaultApi.md#create_player) | **POST** /players | Add a device |
|
11
|
+
| [**create_segments**](DefaultApi.md#create_segments) | **POST** /apps/{app_id}/segments | Create Segments |
|
12
|
+
| [**delete_player**](DefaultApi.md#delete_player) | **DELETE** /players/{player_id} | Delete a user record |
|
13
|
+
| [**delete_segments**](DefaultApi.md#delete_segments) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segments |
|
14
|
+
| [**export_players**](DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | CSV export |
|
15
|
+
| [**get_app**](DefaultApi.md#get_app) | **GET** /apps/{app_id} | View an app |
|
16
|
+
| [**get_apps**](DefaultApi.md#get_apps) | **GET** /apps | View apps |
|
17
|
+
| [**get_notification**](DefaultApi.md#get_notification) | **GET** /notifications/{notification_id} | View notification |
|
18
|
+
| [**get_notification_history**](DefaultApi.md#get_notification_history) | **POST** /notifications/{notification_id}/history | Notification History |
|
19
|
+
| [**get_notifications**](DefaultApi.md#get_notifications) | **GET** /notifications | View notifications |
|
20
|
+
| [**get_outcomes**](DefaultApi.md#get_outcomes) | **GET** /apps/{app_id}/outcomes | View Outcomes |
|
21
|
+
| [**get_player**](DefaultApi.md#get_player) | **GET** /players/{player_id} | View device |
|
22
|
+
| [**get_players**](DefaultApi.md#get_players) | **GET** /players | View devices |
|
23
|
+
| [**update_app**](DefaultApi.md#update_app) | **PUT** /apps/{app_id} | Update an app |
|
24
|
+
| [**update_player**](DefaultApi.md#update_player) | **PUT** /players/{player_id} | Edit device |
|
25
|
+
| [**update_player_tags**](DefaultApi.md#update_player_tags) | **PUT** /apps/{app_id}/users/{external_user_id} | Edit tags with external user id |
|
26
|
+
|
27
|
+
|
28
|
+
## cancel_notification
|
29
|
+
|
30
|
+
> <InlineResponse2001> cancel_notification(app_id, notification_id)
|
31
|
+
|
32
|
+
Stop a scheduled or currently outgoing notification
|
33
|
+
|
34
|
+
Used to stop a scheduled or currently outgoing notification
|
35
|
+
|
36
|
+
### Examples
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'time'
|
40
|
+
require 'onesignal'
|
41
|
+
# setup authorization
|
42
|
+
OneSignal.configure do |config|
|
43
|
+
# Configure Bearer authorization: app_key
|
44
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
45
|
+
end
|
46
|
+
|
47
|
+
api_instance = OneSignal::DefaultApi.new
|
48
|
+
app_id = 'app_id_example' # String |
|
49
|
+
notification_id = 'notification_id_example' # String |
|
50
|
+
|
51
|
+
begin
|
52
|
+
# Stop a scheduled or currently outgoing notification
|
53
|
+
result = api_instance.cancel_notification(app_id, notification_id)
|
54
|
+
p result
|
55
|
+
rescue OneSignal::ApiError => e
|
56
|
+
puts "Error when calling DefaultApi->cancel_notification: #{e}"
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
#### Using the cancel_notification_with_http_info variant
|
61
|
+
|
62
|
+
This returns an Array which contains the response data, status code and headers.
|
63
|
+
|
64
|
+
> <Array(<InlineResponse2001>, Integer, Hash)> cancel_notification_with_http_info(app_id, notification_id)
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
begin
|
68
|
+
# Stop a scheduled or currently outgoing notification
|
69
|
+
data, status_code, headers = api_instance.cancel_notification_with_http_info(app_id, notification_id)
|
70
|
+
p status_code # => 2xx
|
71
|
+
p headers # => { ... }
|
72
|
+
p data # => <InlineResponse2001>
|
73
|
+
rescue OneSignal::ApiError => e
|
74
|
+
puts "Error when calling DefaultApi->cancel_notification_with_http_info: #{e}"
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
### Parameters
|
79
|
+
|
80
|
+
| Name | Type | Description | Notes |
|
81
|
+
| ---- | ---- | ----------- | ----- |
|
82
|
+
| **app_id** | **String** | | |
|
83
|
+
| **notification_id** | **String** | | |
|
84
|
+
|
85
|
+
### Return type
|
86
|
+
|
87
|
+
[**InlineResponse2001**](InlineResponse2001.md)
|
88
|
+
|
89
|
+
### Authorization
|
90
|
+
|
91
|
+
[app_key](../README.md#app_key)
|
92
|
+
|
93
|
+
### HTTP request headers
|
94
|
+
|
95
|
+
- **Content-Type**: Not defined
|
96
|
+
- **Accept**: application/json
|
97
|
+
|
98
|
+
|
99
|
+
## create_app
|
100
|
+
|
101
|
+
> <App> create_app(app)
|
102
|
+
|
103
|
+
Create an app
|
104
|
+
|
105
|
+
Creates a new OneSignal app
|
106
|
+
|
107
|
+
### Examples
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
require 'time'
|
111
|
+
require 'onesignal'
|
112
|
+
# setup authorization
|
113
|
+
OneSignal.configure do |config|
|
114
|
+
# Configure Bearer authorization: user_key
|
115
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
116
|
+
end
|
117
|
+
|
118
|
+
api_instance = OneSignal::DefaultApi.new
|
119
|
+
app = OneSignal::App.new({id: 'id_example'}) # App |
|
120
|
+
|
121
|
+
begin
|
122
|
+
# Create an app
|
123
|
+
result = api_instance.create_app(app)
|
124
|
+
p result
|
125
|
+
rescue OneSignal::ApiError => e
|
126
|
+
puts "Error when calling DefaultApi->create_app: #{e}"
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
#### Using the create_app_with_http_info variant
|
131
|
+
|
132
|
+
This returns an Array which contains the response data, status code and headers.
|
133
|
+
|
134
|
+
> <Array(<App>, Integer, Hash)> create_app_with_http_info(app)
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
begin
|
138
|
+
# Create an app
|
139
|
+
data, status_code, headers = api_instance.create_app_with_http_info(app)
|
140
|
+
p status_code # => 2xx
|
141
|
+
p headers # => { ... }
|
142
|
+
p data # => <App>
|
143
|
+
rescue OneSignal::ApiError => e
|
144
|
+
puts "Error when calling DefaultApi->create_app_with_http_info: #{e}"
|
145
|
+
end
|
146
|
+
```
|
147
|
+
|
148
|
+
### Parameters
|
149
|
+
|
150
|
+
| Name | Type | Description | Notes |
|
151
|
+
| ---- | ---- | ----------- | ----- |
|
152
|
+
| **app** | [**App**](App.md) | | |
|
153
|
+
|
154
|
+
### Return type
|
155
|
+
|
156
|
+
[**App**](App.md)
|
157
|
+
|
158
|
+
### Authorization
|
159
|
+
|
160
|
+
[user_key](../README.md#user_key)
|
161
|
+
|
162
|
+
### HTTP request headers
|
163
|
+
|
164
|
+
- **Content-Type**: application/json
|
165
|
+
- **Accept**: application/json
|
166
|
+
|
167
|
+
|
168
|
+
## create_notification
|
169
|
+
|
170
|
+
> <InlineResponse200> create_notification(notification)
|
171
|
+
|
172
|
+
Create notification
|
173
|
+
|
174
|
+
Sends notifications to your users
|
175
|
+
|
176
|
+
### Examples
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
require 'time'
|
180
|
+
require 'onesignal'
|
181
|
+
# setup authorization
|
182
|
+
OneSignal.configure do |config|
|
183
|
+
# Configure Bearer authorization: app_key
|
184
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
185
|
+
end
|
186
|
+
|
187
|
+
api_instance = OneSignal::DefaultApi.new
|
188
|
+
notification = OneSignal::Notification.new({app_id: 'app_id_example'}) # Notification |
|
189
|
+
|
190
|
+
begin
|
191
|
+
# Create notification
|
192
|
+
result = api_instance.create_notification(notification)
|
193
|
+
p result
|
194
|
+
rescue OneSignal::ApiError => e
|
195
|
+
puts "Error when calling DefaultApi->create_notification: #{e}"
|
196
|
+
end
|
197
|
+
```
|
198
|
+
|
199
|
+
#### Using the create_notification_with_http_info variant
|
200
|
+
|
201
|
+
This returns an Array which contains the response data, status code and headers.
|
202
|
+
|
203
|
+
> <Array(<InlineResponse200>, Integer, Hash)> create_notification_with_http_info(notification)
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
begin
|
207
|
+
# Create notification
|
208
|
+
data, status_code, headers = api_instance.create_notification_with_http_info(notification)
|
209
|
+
p status_code # => 2xx
|
210
|
+
p headers # => { ... }
|
211
|
+
p data # => <InlineResponse200>
|
212
|
+
rescue OneSignal::ApiError => e
|
213
|
+
puts "Error when calling DefaultApi->create_notification_with_http_info: #{e}"
|
214
|
+
end
|
215
|
+
```
|
216
|
+
|
217
|
+
### Parameters
|
218
|
+
|
219
|
+
| Name | Type | Description | Notes |
|
220
|
+
| ---- | ---- | ----------- | ----- |
|
221
|
+
| **notification** | [**Notification**](Notification.md) | | |
|
222
|
+
|
223
|
+
### Return type
|
224
|
+
|
225
|
+
[**InlineResponse200**](InlineResponse200.md)
|
226
|
+
|
227
|
+
### Authorization
|
228
|
+
|
229
|
+
[app_key](../README.md#app_key)
|
230
|
+
|
231
|
+
### HTTP request headers
|
232
|
+
|
233
|
+
- **Content-Type**: application/json
|
234
|
+
- **Accept**: application/json
|
235
|
+
|
236
|
+
|
237
|
+
## create_player
|
238
|
+
|
239
|
+
> <InlineResponse2004> create_player(player)
|
240
|
+
|
241
|
+
Add a device
|
242
|
+
|
243
|
+
Register a new device to one of your OneSignal apps 🚧 Don't use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won't work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds.
|
244
|
+
|
245
|
+
### Examples
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
require 'time'
|
249
|
+
require 'onesignal'
|
250
|
+
# setup authorization
|
251
|
+
OneSignal.configure do |config|
|
252
|
+
# Configure Bearer authorization: app_key
|
253
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
254
|
+
end
|
255
|
+
|
256
|
+
api_instance = OneSignal::DefaultApi.new
|
257
|
+
player = OneSignal::Player.new({id: 'id_example', app_id: 'app_id_example', device_type: 37}) # Player |
|
258
|
+
|
259
|
+
begin
|
260
|
+
# Add a device
|
261
|
+
result = api_instance.create_player(player)
|
262
|
+
p result
|
263
|
+
rescue OneSignal::ApiError => e
|
264
|
+
puts "Error when calling DefaultApi->create_player: #{e}"
|
265
|
+
end
|
266
|
+
```
|
267
|
+
|
268
|
+
#### Using the create_player_with_http_info variant
|
269
|
+
|
270
|
+
This returns an Array which contains the response data, status code and headers.
|
271
|
+
|
272
|
+
> <Array(<InlineResponse2004>, Integer, Hash)> create_player_with_http_info(player)
|
273
|
+
|
274
|
+
```ruby
|
275
|
+
begin
|
276
|
+
# Add a device
|
277
|
+
data, status_code, headers = api_instance.create_player_with_http_info(player)
|
278
|
+
p status_code # => 2xx
|
279
|
+
p headers # => { ... }
|
280
|
+
p data # => <InlineResponse2004>
|
281
|
+
rescue OneSignal::ApiError => e
|
282
|
+
puts "Error when calling DefaultApi->create_player_with_http_info: #{e}"
|
283
|
+
end
|
284
|
+
```
|
285
|
+
|
286
|
+
### Parameters
|
287
|
+
|
288
|
+
| Name | Type | Description | Notes |
|
289
|
+
| ---- | ---- | ----------- | ----- |
|
290
|
+
| **player** | [**Player**](Player.md) | | |
|
291
|
+
|
292
|
+
### Return type
|
293
|
+
|
294
|
+
[**InlineResponse2004**](InlineResponse2004.md)
|
295
|
+
|
296
|
+
### Authorization
|
297
|
+
|
298
|
+
[app_key](../README.md#app_key)
|
299
|
+
|
300
|
+
### HTTP request headers
|
301
|
+
|
302
|
+
- **Content-Type**: application/json
|
303
|
+
- **Accept**: application/json
|
304
|
+
|
305
|
+
|
306
|
+
## create_segments
|
307
|
+
|
308
|
+
> <InlineResponse201> create_segments(app_id, opts)
|
309
|
+
|
310
|
+
Create Segments
|
311
|
+
|
312
|
+
Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator's. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit.
|
313
|
+
|
314
|
+
### Examples
|
315
|
+
|
316
|
+
```ruby
|
317
|
+
require 'time'
|
318
|
+
require 'onesignal'
|
319
|
+
# setup authorization
|
320
|
+
OneSignal.configure do |config|
|
321
|
+
# Configure Bearer authorization: app_key
|
322
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
323
|
+
end
|
324
|
+
|
325
|
+
api_instance = OneSignal::DefaultApi.new
|
326
|
+
app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
327
|
+
opts = {
|
328
|
+
segment: OneSignal::Segment.new({name: 'name_example', filters: [OneSignal::FilterExpressions.new({field: 'field_example', relation: '>'})]}) # Segment |
|
329
|
+
}
|
330
|
+
|
331
|
+
begin
|
332
|
+
# Create Segments
|
333
|
+
result = api_instance.create_segments(app_id, opts)
|
334
|
+
p result
|
335
|
+
rescue OneSignal::ApiError => e
|
336
|
+
puts "Error when calling DefaultApi->create_segments: #{e}"
|
337
|
+
end
|
338
|
+
```
|
339
|
+
|
340
|
+
#### Using the create_segments_with_http_info variant
|
341
|
+
|
342
|
+
This returns an Array which contains the response data, status code and headers.
|
343
|
+
|
344
|
+
> <Array(<InlineResponse201>, Integer, Hash)> create_segments_with_http_info(app_id, opts)
|
345
|
+
|
346
|
+
```ruby
|
347
|
+
begin
|
348
|
+
# Create Segments
|
349
|
+
data, status_code, headers = api_instance.create_segments_with_http_info(app_id, opts)
|
350
|
+
p status_code # => 2xx
|
351
|
+
p headers # => { ... }
|
352
|
+
p data # => <InlineResponse201>
|
353
|
+
rescue OneSignal::ApiError => e
|
354
|
+
puts "Error when calling DefaultApi->create_segments_with_http_info: #{e}"
|
355
|
+
end
|
356
|
+
```
|
357
|
+
|
358
|
+
### Parameters
|
359
|
+
|
360
|
+
| Name | Type | Description | Notes |
|
361
|
+
| ---- | ---- | ----------- | ----- |
|
362
|
+
| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | |
|
363
|
+
| **segment** | [**Segment**](Segment.md) | | [optional] |
|
364
|
+
|
365
|
+
### Return type
|
366
|
+
|
367
|
+
[**InlineResponse201**](InlineResponse201.md)
|
368
|
+
|
369
|
+
### Authorization
|
370
|
+
|
371
|
+
[app_key](../README.md#app_key)
|
372
|
+
|
373
|
+
### HTTP request headers
|
374
|
+
|
375
|
+
- **Content-Type**: application/json
|
376
|
+
- **Accept**: application/json
|
377
|
+
|
378
|
+
|
379
|
+
## delete_player
|
380
|
+
|
381
|
+
> <InlineResponse2001> delete_player(app_id, player_id)
|
382
|
+
|
383
|
+
Delete a user record
|
384
|
+
|
385
|
+
Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
|
386
|
+
|
387
|
+
### Examples
|
388
|
+
|
389
|
+
```ruby
|
390
|
+
require 'time'
|
391
|
+
require 'onesignal'
|
392
|
+
# setup authorization
|
393
|
+
OneSignal.configure do |config|
|
394
|
+
# Configure Bearer authorization: app_key
|
395
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
396
|
+
end
|
397
|
+
|
398
|
+
api_instance = OneSignal::DefaultApi.new
|
399
|
+
app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
400
|
+
player_id = 'player_id_example' # String | The OneSignal player_id
|
401
|
+
|
402
|
+
begin
|
403
|
+
# Delete a user record
|
404
|
+
result = api_instance.delete_player(app_id, player_id)
|
405
|
+
p result
|
406
|
+
rescue OneSignal::ApiError => e
|
407
|
+
puts "Error when calling DefaultApi->delete_player: #{e}"
|
408
|
+
end
|
409
|
+
```
|
410
|
+
|
411
|
+
#### Using the delete_player_with_http_info variant
|
412
|
+
|
413
|
+
This returns an Array which contains the response data, status code and headers.
|
414
|
+
|
415
|
+
> <Array(<InlineResponse2001>, Integer, Hash)> delete_player_with_http_info(app_id, player_id)
|
416
|
+
|
417
|
+
```ruby
|
418
|
+
begin
|
419
|
+
# Delete a user record
|
420
|
+
data, status_code, headers = api_instance.delete_player_with_http_info(app_id, player_id)
|
421
|
+
p status_code # => 2xx
|
422
|
+
p headers # => { ... }
|
423
|
+
p data # => <InlineResponse2001>
|
424
|
+
rescue OneSignal::ApiError => e
|
425
|
+
puts "Error when calling DefaultApi->delete_player_with_http_info: #{e}"
|
426
|
+
end
|
427
|
+
```
|
428
|
+
|
429
|
+
### Parameters
|
430
|
+
|
431
|
+
| Name | Type | Description | Notes |
|
432
|
+
| ---- | ---- | ----------- | ----- |
|
433
|
+
| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | |
|
434
|
+
| **player_id** | **String** | The OneSignal player_id | |
|
435
|
+
|
436
|
+
### Return type
|
437
|
+
|
438
|
+
[**InlineResponse2001**](InlineResponse2001.md)
|
439
|
+
|
440
|
+
### Authorization
|
441
|
+
|
442
|
+
[app_key](../README.md#app_key)
|
443
|
+
|
444
|
+
### HTTP request headers
|
445
|
+
|
446
|
+
- **Content-Type**: Not defined
|
447
|
+
- **Accept**: application/json
|
448
|
+
|
449
|
+
|
450
|
+
## delete_segments
|
451
|
+
|
452
|
+
> <InlineResponse2003> delete_segments(app_id, segment_id)
|
453
|
+
|
454
|
+
Delete Segments
|
455
|
+
|
456
|
+
Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard.
|
457
|
+
|
458
|
+
### Examples
|
459
|
+
|
460
|
+
```ruby
|
461
|
+
require 'time'
|
462
|
+
require 'onesignal'
|
463
|
+
# setup authorization
|
464
|
+
OneSignal.configure do |config|
|
465
|
+
# Configure Bearer authorization: app_key
|
466
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
467
|
+
end
|
468
|
+
|
469
|
+
api_instance = OneSignal::DefaultApi.new
|
470
|
+
app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
471
|
+
segment_id = 'segment_id_example' # String | The segment_id can be found in the URL of the segment when viewing it in the dashboard.
|
472
|
+
|
473
|
+
begin
|
474
|
+
# Delete Segments
|
475
|
+
result = api_instance.delete_segments(app_id, segment_id)
|
476
|
+
p result
|
477
|
+
rescue OneSignal::ApiError => e
|
478
|
+
puts "Error when calling DefaultApi->delete_segments: #{e}"
|
479
|
+
end
|
480
|
+
```
|
481
|
+
|
482
|
+
#### Using the delete_segments_with_http_info variant
|
483
|
+
|
484
|
+
This returns an Array which contains the response data, status code and headers.
|
485
|
+
|
486
|
+
> <Array(<InlineResponse2003>, Integer, Hash)> delete_segments_with_http_info(app_id, segment_id)
|
487
|
+
|
488
|
+
```ruby
|
489
|
+
begin
|
490
|
+
# Delete Segments
|
491
|
+
data, status_code, headers = api_instance.delete_segments_with_http_info(app_id, segment_id)
|
492
|
+
p status_code # => 2xx
|
493
|
+
p headers # => { ... }
|
494
|
+
p data # => <InlineResponse2003>
|
495
|
+
rescue OneSignal::ApiError => e
|
496
|
+
puts "Error when calling DefaultApi->delete_segments_with_http_info: #{e}"
|
497
|
+
end
|
498
|
+
```
|
499
|
+
|
500
|
+
### Parameters
|
501
|
+
|
502
|
+
| Name | Type | Description | Notes |
|
503
|
+
| ---- | ---- | ----------- | ----- |
|
504
|
+
| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | |
|
505
|
+
| **segment_id** | **String** | The segment_id can be found in the URL of the segment when viewing it in the dashboard. | |
|
506
|
+
|
507
|
+
### Return type
|
508
|
+
|
509
|
+
[**InlineResponse2003**](InlineResponse2003.md)
|
510
|
+
|
511
|
+
### Authorization
|
512
|
+
|
513
|
+
[app_key](../README.md#app_key)
|
514
|
+
|
515
|
+
### HTTP request headers
|
516
|
+
|
517
|
+
- **Content-Type**: Not defined
|
518
|
+
- **Accept**: application/json
|
519
|
+
|
520
|
+
|
521
|
+
## export_players
|
522
|
+
|
523
|
+
> <InlineResponse2005> export_players(app_id, opts)
|
524
|
+
|
525
|
+
CSV export
|
526
|
+
|
527
|
+
Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. |
|
528
|
+
|
529
|
+
### Examples
|
530
|
+
|
531
|
+
```ruby
|
532
|
+
require 'time'
|
533
|
+
require 'onesignal'
|
534
|
+
# setup authorization
|
535
|
+
OneSignal.configure do |config|
|
536
|
+
# Configure Bearer authorization: app_key
|
537
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
538
|
+
end
|
539
|
+
|
540
|
+
api_instance = OneSignal::DefaultApi.new
|
541
|
+
app_id = 'app_id_example' # String | The app ID that you want to export devices from
|
542
|
+
opts = {
|
543
|
+
export_players_request_body: OneSignal::ExportPlayersRequestBody.new # ExportPlayersRequestBody |
|
544
|
+
}
|
545
|
+
|
546
|
+
begin
|
547
|
+
# CSV export
|
548
|
+
result = api_instance.export_players(app_id, opts)
|
549
|
+
p result
|
550
|
+
rescue OneSignal::ApiError => e
|
551
|
+
puts "Error when calling DefaultApi->export_players: #{e}"
|
552
|
+
end
|
553
|
+
```
|
554
|
+
|
555
|
+
#### Using the export_players_with_http_info variant
|
556
|
+
|
557
|
+
This returns an Array which contains the response data, status code and headers.
|
558
|
+
|
559
|
+
> <Array(<InlineResponse2005>, Integer, Hash)> export_players_with_http_info(app_id, opts)
|
560
|
+
|
561
|
+
```ruby
|
562
|
+
begin
|
563
|
+
# CSV export
|
564
|
+
data, status_code, headers = api_instance.export_players_with_http_info(app_id, opts)
|
565
|
+
p status_code # => 2xx
|
566
|
+
p headers # => { ... }
|
567
|
+
p data # => <InlineResponse2005>
|
568
|
+
rescue OneSignal::ApiError => e
|
569
|
+
puts "Error when calling DefaultApi->export_players_with_http_info: #{e}"
|
570
|
+
end
|
571
|
+
```
|
572
|
+
|
573
|
+
### Parameters
|
574
|
+
|
575
|
+
| Name | Type | Description | Notes |
|
576
|
+
| ---- | ---- | ----------- | ----- |
|
577
|
+
| **app_id** | **String** | The app ID that you want to export devices from | |
|
578
|
+
| **export_players_request_body** | [**ExportPlayersRequestBody**](ExportPlayersRequestBody.md) | | [optional] |
|
579
|
+
|
580
|
+
### Return type
|
581
|
+
|
582
|
+
[**InlineResponse2005**](InlineResponse2005.md)
|
583
|
+
|
584
|
+
### Authorization
|
585
|
+
|
586
|
+
[app_key](../README.md#app_key)
|
587
|
+
|
588
|
+
### HTTP request headers
|
589
|
+
|
590
|
+
- **Content-Type**: application/json
|
591
|
+
- **Accept**: application/json
|
592
|
+
|
593
|
+
|
594
|
+
## get_app
|
595
|
+
|
596
|
+
> <App> get_app(app_id)
|
597
|
+
|
598
|
+
View an app
|
599
|
+
|
600
|
+
View the details of a single OneSignal app
|
601
|
+
|
602
|
+
### Examples
|
603
|
+
|
604
|
+
```ruby
|
605
|
+
require 'time'
|
606
|
+
require 'onesignal'
|
607
|
+
# setup authorization
|
608
|
+
OneSignal.configure do |config|
|
609
|
+
# Configure Bearer authorization: user_key
|
610
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
611
|
+
end
|
612
|
+
|
613
|
+
api_instance = OneSignal::DefaultApi.new
|
614
|
+
app_id = 'app_id_example' # String | An app id
|
615
|
+
|
616
|
+
begin
|
617
|
+
# View an app
|
618
|
+
result = api_instance.get_app(app_id)
|
619
|
+
p result
|
620
|
+
rescue OneSignal::ApiError => e
|
621
|
+
puts "Error when calling DefaultApi->get_app: #{e}"
|
622
|
+
end
|
623
|
+
```
|
624
|
+
|
625
|
+
#### Using the get_app_with_http_info variant
|
626
|
+
|
627
|
+
This returns an Array which contains the response data, status code and headers.
|
628
|
+
|
629
|
+
> <Array(<App>, Integer, Hash)> get_app_with_http_info(app_id)
|
630
|
+
|
631
|
+
```ruby
|
632
|
+
begin
|
633
|
+
# View an app
|
634
|
+
data, status_code, headers = api_instance.get_app_with_http_info(app_id)
|
635
|
+
p status_code # => 2xx
|
636
|
+
p headers # => { ... }
|
637
|
+
p data # => <App>
|
638
|
+
rescue OneSignal::ApiError => e
|
639
|
+
puts "Error when calling DefaultApi->get_app_with_http_info: #{e}"
|
640
|
+
end
|
641
|
+
```
|
642
|
+
|
643
|
+
### Parameters
|
644
|
+
|
645
|
+
| Name | Type | Description | Notes |
|
646
|
+
| ---- | ---- | ----------- | ----- |
|
647
|
+
| **app_id** | **String** | An app id | |
|
648
|
+
|
649
|
+
### Return type
|
650
|
+
|
651
|
+
[**App**](App.md)
|
652
|
+
|
653
|
+
### Authorization
|
654
|
+
|
655
|
+
[user_key](../README.md#user_key)
|
656
|
+
|
657
|
+
### HTTP request headers
|
658
|
+
|
659
|
+
- **Content-Type**: Not defined
|
660
|
+
- **Accept**: application/json
|
661
|
+
|
662
|
+
|
663
|
+
## get_apps
|
664
|
+
|
665
|
+
> String get_apps
|
666
|
+
|
667
|
+
View apps
|
668
|
+
|
669
|
+
View the details of all of your current OneSignal apps
|
670
|
+
|
671
|
+
### Examples
|
672
|
+
|
673
|
+
```ruby
|
674
|
+
require 'time'
|
675
|
+
require 'onesignal'
|
676
|
+
# setup authorization
|
677
|
+
OneSignal.configure do |config|
|
678
|
+
# Configure Bearer authorization: user_key
|
679
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
680
|
+
end
|
681
|
+
|
682
|
+
api_instance = OneSignal::DefaultApi.new
|
683
|
+
|
684
|
+
begin
|
685
|
+
# View apps
|
686
|
+
result = api_instance.get_apps
|
687
|
+
p result
|
688
|
+
rescue OneSignal::ApiError => e
|
689
|
+
puts "Error when calling DefaultApi->get_apps: #{e}"
|
690
|
+
end
|
691
|
+
```
|
692
|
+
|
693
|
+
#### Using the get_apps_with_http_info variant
|
694
|
+
|
695
|
+
This returns an Array which contains the response data, status code and headers.
|
696
|
+
|
697
|
+
> <Array(String, Integer, Hash)> get_apps_with_http_info
|
698
|
+
|
699
|
+
```ruby
|
700
|
+
begin
|
701
|
+
# View apps
|
702
|
+
data, status_code, headers = api_instance.get_apps_with_http_info
|
703
|
+
p status_code # => 2xx
|
704
|
+
p headers # => { ... }
|
705
|
+
p data # => String
|
706
|
+
rescue OneSignal::ApiError => e
|
707
|
+
puts "Error when calling DefaultApi->get_apps_with_http_info: #{e}"
|
708
|
+
end
|
709
|
+
```
|
710
|
+
|
711
|
+
### Parameters
|
712
|
+
|
713
|
+
This endpoint does not need any parameter.
|
714
|
+
|
715
|
+
### Return type
|
716
|
+
|
717
|
+
**String**
|
718
|
+
|
719
|
+
### Authorization
|
720
|
+
|
721
|
+
[user_key](../README.md#user_key)
|
722
|
+
|
723
|
+
### HTTP request headers
|
724
|
+
|
725
|
+
- **Content-Type**: Not defined
|
726
|
+
- **Accept**: application/json
|
727
|
+
|
728
|
+
|
729
|
+
## get_notification
|
730
|
+
|
731
|
+
> <Notification> get_notification(app_id, notification_id)
|
732
|
+
|
733
|
+
View notification
|
734
|
+
|
735
|
+
View the details of a single notification and outcomes associated with it
|
736
|
+
|
737
|
+
### Examples
|
738
|
+
|
739
|
+
```ruby
|
740
|
+
require 'time'
|
741
|
+
require 'onesignal'
|
742
|
+
# setup authorization
|
743
|
+
OneSignal.configure do |config|
|
744
|
+
# Configure Bearer authorization: app_key
|
745
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
746
|
+
end
|
747
|
+
|
748
|
+
api_instance = OneSignal::DefaultApi.new
|
749
|
+
app_id = 'app_id_example' # String |
|
750
|
+
notification_id = 'notification_id_example' # String |
|
751
|
+
|
752
|
+
begin
|
753
|
+
# View notification
|
754
|
+
result = api_instance.get_notification(app_id, notification_id)
|
755
|
+
p result
|
756
|
+
rescue OneSignal::ApiError => e
|
757
|
+
puts "Error when calling DefaultApi->get_notification: #{e}"
|
758
|
+
end
|
759
|
+
```
|
760
|
+
|
761
|
+
#### Using the get_notification_with_http_info variant
|
762
|
+
|
763
|
+
This returns an Array which contains the response data, status code and headers.
|
764
|
+
|
765
|
+
> <Array(<Notification>, Integer, Hash)> get_notification_with_http_info(app_id, notification_id)
|
766
|
+
|
767
|
+
```ruby
|
768
|
+
begin
|
769
|
+
# View notification
|
770
|
+
data, status_code, headers = api_instance.get_notification_with_http_info(app_id, notification_id)
|
771
|
+
p status_code # => 2xx
|
772
|
+
p headers # => { ... }
|
773
|
+
p data # => <Notification>
|
774
|
+
rescue OneSignal::ApiError => e
|
775
|
+
puts "Error when calling DefaultApi->get_notification_with_http_info: #{e}"
|
776
|
+
end
|
777
|
+
```
|
778
|
+
|
779
|
+
### Parameters
|
780
|
+
|
781
|
+
| Name | Type | Description | Notes |
|
782
|
+
| ---- | ---- | ----------- | ----- |
|
783
|
+
| **app_id** | **String** | | |
|
784
|
+
| **notification_id** | **String** | | |
|
785
|
+
|
786
|
+
### Return type
|
787
|
+
|
788
|
+
[**Notification**](Notification.md)
|
789
|
+
|
790
|
+
### Authorization
|
791
|
+
|
792
|
+
[app_key](../README.md#app_key)
|
793
|
+
|
794
|
+
### HTTP request headers
|
795
|
+
|
796
|
+
- **Content-Type**: Not defined
|
797
|
+
- **Accept**: application/json
|
798
|
+
|
799
|
+
|
800
|
+
## get_notification_history
|
801
|
+
|
802
|
+
> <InlineResponse2002> get_notification_history(notification_id, get_notification_request_body)
|
803
|
+
|
804
|
+
Notification History
|
805
|
+
|
806
|
+
-> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App's REST API Key, available in Keys & IDs.
|
807
|
+
|
808
|
+
### Examples
|
809
|
+
|
810
|
+
```ruby
|
811
|
+
require 'time'
|
812
|
+
require 'onesignal'
|
813
|
+
# setup authorization
|
814
|
+
OneSignal.configure do |config|
|
815
|
+
# Configure Bearer authorization: app_key
|
816
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
817
|
+
end
|
818
|
+
|
819
|
+
api_instance = OneSignal::DefaultApi.new
|
820
|
+
notification_id = 'notification_id_example' # String | The \"id\" of the message found in the Notification object
|
821
|
+
get_notification_request_body = OneSignal::GetNotificationRequestBody.new # GetNotificationRequestBody |
|
822
|
+
|
823
|
+
begin
|
824
|
+
# Notification History
|
825
|
+
result = api_instance.get_notification_history(notification_id, get_notification_request_body)
|
826
|
+
p result
|
827
|
+
rescue OneSignal::ApiError => e
|
828
|
+
puts "Error when calling DefaultApi->get_notification_history: #{e}"
|
829
|
+
end
|
830
|
+
```
|
831
|
+
|
832
|
+
#### Using the get_notification_history_with_http_info variant
|
833
|
+
|
834
|
+
This returns an Array which contains the response data, status code and headers.
|
835
|
+
|
836
|
+
> <Array(<InlineResponse2002>, Integer, Hash)> get_notification_history_with_http_info(notification_id, get_notification_request_body)
|
837
|
+
|
838
|
+
```ruby
|
839
|
+
begin
|
840
|
+
# Notification History
|
841
|
+
data, status_code, headers = api_instance.get_notification_history_with_http_info(notification_id, get_notification_request_body)
|
842
|
+
p status_code # => 2xx
|
843
|
+
p headers # => { ... }
|
844
|
+
p data # => <InlineResponse2002>
|
845
|
+
rescue OneSignal::ApiError => e
|
846
|
+
puts "Error when calling DefaultApi->get_notification_history_with_http_info: #{e}"
|
847
|
+
end
|
848
|
+
```
|
849
|
+
|
850
|
+
### Parameters
|
851
|
+
|
852
|
+
| Name | Type | Description | Notes |
|
853
|
+
| ---- | ---- | ----------- | ----- |
|
854
|
+
| **notification_id** | **String** | The \"id\" of the message found in the Notification object | |
|
855
|
+
| **get_notification_request_body** | [**GetNotificationRequestBody**](GetNotificationRequestBody.md) | | |
|
856
|
+
|
857
|
+
### Return type
|
858
|
+
|
859
|
+
[**InlineResponse2002**](InlineResponse2002.md)
|
860
|
+
|
861
|
+
### Authorization
|
862
|
+
|
863
|
+
[app_key](../README.md#app_key)
|
864
|
+
|
865
|
+
### HTTP request headers
|
866
|
+
|
867
|
+
- **Content-Type**: application/json
|
868
|
+
- **Accept**: application/json
|
869
|
+
|
870
|
+
|
871
|
+
## get_notifications
|
872
|
+
|
873
|
+
> <NotificationSlice> get_notifications(app_id, opts)
|
874
|
+
|
875
|
+
View notifications
|
876
|
+
|
877
|
+
View the details of multiple notifications
|
878
|
+
|
879
|
+
### Examples
|
880
|
+
|
881
|
+
```ruby
|
882
|
+
require 'time'
|
883
|
+
require 'onesignal'
|
884
|
+
# setup authorization
|
885
|
+
OneSignal.configure do |config|
|
886
|
+
# Configure Bearer authorization: app_key
|
887
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
888
|
+
end
|
889
|
+
|
890
|
+
api_instance = OneSignal::DefaultApi.new
|
891
|
+
app_id = 'app_id_example' # String | The app ID that you want to view notifications from
|
892
|
+
opts = {
|
893
|
+
limit: 'limit_example', # String | How many notifications to return. Max is 50. Default is 50.
|
894
|
+
offset: 56, # Integer | Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at.
|
895
|
+
kind: 0 # Integer | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only
|
896
|
+
}
|
897
|
+
|
898
|
+
begin
|
899
|
+
# View notifications
|
900
|
+
result = api_instance.get_notifications(app_id, opts)
|
901
|
+
p result
|
902
|
+
rescue OneSignal::ApiError => e
|
903
|
+
puts "Error when calling DefaultApi->get_notifications: #{e}"
|
904
|
+
end
|
905
|
+
```
|
906
|
+
|
907
|
+
#### Using the get_notifications_with_http_info variant
|
908
|
+
|
909
|
+
This returns an Array which contains the response data, status code and headers.
|
910
|
+
|
911
|
+
> <Array(<NotificationSlice>, Integer, Hash)> get_notifications_with_http_info(app_id, opts)
|
912
|
+
|
913
|
+
```ruby
|
914
|
+
begin
|
915
|
+
# View notifications
|
916
|
+
data, status_code, headers = api_instance.get_notifications_with_http_info(app_id, opts)
|
917
|
+
p status_code # => 2xx
|
918
|
+
p headers # => { ... }
|
919
|
+
p data # => <NotificationSlice>
|
920
|
+
rescue OneSignal::ApiError => e
|
921
|
+
puts "Error when calling DefaultApi->get_notifications_with_http_info: #{e}"
|
922
|
+
end
|
923
|
+
```
|
924
|
+
|
925
|
+
### Parameters
|
926
|
+
|
927
|
+
| Name | Type | Description | Notes |
|
928
|
+
| ---- | ---- | ----------- | ----- |
|
929
|
+
| **app_id** | **String** | The app ID that you want to view notifications from | |
|
930
|
+
| **limit** | **String** | How many notifications to return. Max is 50. Default is 50. | [optional] |
|
931
|
+
| **offset** | **Integer** | Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. | [optional] |
|
932
|
+
| **kind** | **Integer** | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only | [optional] |
|
933
|
+
|
934
|
+
### Return type
|
935
|
+
|
936
|
+
[**NotificationSlice**](NotificationSlice.md)
|
937
|
+
|
938
|
+
### Authorization
|
939
|
+
|
940
|
+
[app_key](../README.md#app_key)
|
941
|
+
|
942
|
+
### HTTP request headers
|
943
|
+
|
944
|
+
- **Content-Type**: Not defined
|
945
|
+
- **Accept**: application/json
|
946
|
+
|
947
|
+
|
948
|
+
## get_outcomes
|
949
|
+
|
950
|
+
> <Array<OutcomeData>> get_outcomes(app_id, outcome_names, opts)
|
951
|
+
|
952
|
+
View Outcomes
|
953
|
+
|
954
|
+
View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.
|
955
|
+
|
956
|
+
### Examples
|
957
|
+
|
958
|
+
```ruby
|
959
|
+
require 'time'
|
960
|
+
require 'onesignal'
|
961
|
+
# setup authorization
|
962
|
+
OneSignal.configure do |config|
|
963
|
+
# Configure Bearer authorization: app_key
|
964
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
965
|
+
end
|
966
|
+
|
967
|
+
api_instance = OneSignal::DefaultApi.new
|
968
|
+
app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
969
|
+
outcome_names = 'outcome_names_example' # String | Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum
|
970
|
+
opts = {
|
971
|
+
outcome_names2: 'outcome_names_example', # String | Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name.
|
972
|
+
outcome_time_range: 'outcome_time_range_example', # String | Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted.
|
973
|
+
outcome_platforms: 'outcome_platforms_example', # String | Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted.
|
974
|
+
outcome_attribution: 'outcome_attribution_example' # String | Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted.
|
975
|
+
}
|
976
|
+
|
977
|
+
begin
|
978
|
+
# View Outcomes
|
979
|
+
result = api_instance.get_outcomes(app_id, outcome_names, opts)
|
980
|
+
p result
|
981
|
+
rescue OneSignal::ApiError => e
|
982
|
+
puts "Error when calling DefaultApi->get_outcomes: #{e}"
|
983
|
+
end
|
984
|
+
```
|
985
|
+
|
986
|
+
#### Using the get_outcomes_with_http_info variant
|
987
|
+
|
988
|
+
This returns an Array which contains the response data, status code and headers.
|
989
|
+
|
990
|
+
> <Array(<Array<OutcomeData>>, Integer, Hash)> get_outcomes_with_http_info(app_id, outcome_names, opts)
|
991
|
+
|
992
|
+
```ruby
|
993
|
+
begin
|
994
|
+
# View Outcomes
|
995
|
+
data, status_code, headers = api_instance.get_outcomes_with_http_info(app_id, outcome_names, opts)
|
996
|
+
p status_code # => 2xx
|
997
|
+
p headers # => { ... }
|
998
|
+
p data # => <Array<OutcomeData>>
|
999
|
+
rescue OneSignal::ApiError => e
|
1000
|
+
puts "Error when calling DefaultApi->get_outcomes_with_http_info: #{e}"
|
1001
|
+
end
|
1002
|
+
```
|
1003
|
+
|
1004
|
+
### Parameters
|
1005
|
+
|
1006
|
+
| Name | Type | Description | Notes |
|
1007
|
+
| ---- | ---- | ----------- | ----- |
|
1008
|
+
| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | |
|
1009
|
+
| **outcome_names** | **String** | Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum | |
|
1010
|
+
| **outcome_names2** | **String** | Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name. | [optional] |
|
1011
|
+
| **outcome_time_range** | **String** | Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. | [optional] |
|
1012
|
+
| **outcome_platforms** | **String** | Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. | [optional] |
|
1013
|
+
| **outcome_attribution** | **String** | Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. | [optional] |
|
1014
|
+
|
1015
|
+
### Return type
|
1016
|
+
|
1017
|
+
[**Array<OutcomeData>**](OutcomeData.md)
|
1018
|
+
|
1019
|
+
### Authorization
|
1020
|
+
|
1021
|
+
[app_key](../README.md#app_key)
|
1022
|
+
|
1023
|
+
### HTTP request headers
|
1024
|
+
|
1025
|
+
- **Content-Type**: Not defined
|
1026
|
+
- **Accept**: application/json
|
1027
|
+
|
1028
|
+
|
1029
|
+
## get_player
|
1030
|
+
|
1031
|
+
> <Player> get_player(app_id, player_id, opts)
|
1032
|
+
|
1033
|
+
View device
|
1034
|
+
|
1035
|
+
View the details of an existing device in one of your OneSignal apps
|
1036
|
+
|
1037
|
+
### Examples
|
1038
|
+
|
1039
|
+
```ruby
|
1040
|
+
require 'time'
|
1041
|
+
require 'onesignal'
|
1042
|
+
# setup authorization
|
1043
|
+
OneSignal.configure do |config|
|
1044
|
+
# Configure Bearer authorization: app_key
|
1045
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
api_instance = OneSignal::DefaultApi.new
|
1049
|
+
app_id = 'app_id_example' # String | Your app_id for this device
|
1050
|
+
player_id = 'player_id_example' # String | Player's OneSignal ID
|
1051
|
+
opts = {
|
1052
|
+
email_auth_hash: 'email_auth_hash_example' # String | Email - Only required if you have enabled Identity Verification and device_type is email (11).
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
begin
|
1056
|
+
# View device
|
1057
|
+
result = api_instance.get_player(app_id, player_id, opts)
|
1058
|
+
p result
|
1059
|
+
rescue OneSignal::ApiError => e
|
1060
|
+
puts "Error when calling DefaultApi->get_player: #{e}"
|
1061
|
+
end
|
1062
|
+
```
|
1063
|
+
|
1064
|
+
#### Using the get_player_with_http_info variant
|
1065
|
+
|
1066
|
+
This returns an Array which contains the response data, status code and headers.
|
1067
|
+
|
1068
|
+
> <Array(<Player>, Integer, Hash)> get_player_with_http_info(app_id, player_id, opts)
|
1069
|
+
|
1070
|
+
```ruby
|
1071
|
+
begin
|
1072
|
+
# View device
|
1073
|
+
data, status_code, headers = api_instance.get_player_with_http_info(app_id, player_id, opts)
|
1074
|
+
p status_code # => 2xx
|
1075
|
+
p headers # => { ... }
|
1076
|
+
p data # => <Player>
|
1077
|
+
rescue OneSignal::ApiError => e
|
1078
|
+
puts "Error when calling DefaultApi->get_player_with_http_info: #{e}"
|
1079
|
+
end
|
1080
|
+
```
|
1081
|
+
|
1082
|
+
### Parameters
|
1083
|
+
|
1084
|
+
| Name | Type | Description | Notes |
|
1085
|
+
| ---- | ---- | ----------- | ----- |
|
1086
|
+
| **app_id** | **String** | Your app_id for this device | |
|
1087
|
+
| **player_id** | **String** | Player's OneSignal ID | |
|
1088
|
+
| **email_auth_hash** | **String** | Email - Only required if you have enabled Identity Verification and device_type is email (11). | [optional] |
|
1089
|
+
|
1090
|
+
### Return type
|
1091
|
+
|
1092
|
+
[**Player**](Player.md)
|
1093
|
+
|
1094
|
+
### Authorization
|
1095
|
+
|
1096
|
+
[app_key](../README.md#app_key)
|
1097
|
+
|
1098
|
+
### HTTP request headers
|
1099
|
+
|
1100
|
+
- **Content-Type**: Not defined
|
1101
|
+
- **Accept**: application/json
|
1102
|
+
|
1103
|
+
|
1104
|
+
## get_players
|
1105
|
+
|
1106
|
+
> <PlayerSlice> get_players(app_id, opts)
|
1107
|
+
|
1108
|
+
View devices
|
1109
|
+
|
1110
|
+
View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant.
|
1111
|
+
|
1112
|
+
### Examples
|
1113
|
+
|
1114
|
+
```ruby
|
1115
|
+
require 'time'
|
1116
|
+
require 'onesignal'
|
1117
|
+
# setup authorization
|
1118
|
+
OneSignal.configure do |config|
|
1119
|
+
# Configure Bearer authorization: app_key
|
1120
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
api_instance = OneSignal::DefaultApi.new
|
1124
|
+
app_id = 'app_id_example' # String | The app ID that you want to view players from
|
1125
|
+
opts = {
|
1126
|
+
limit: 'limit_example', # String | How many devices to return. Max is 300. Default is 300
|
1127
|
+
offset: 56 # Integer | Result offset. Default is 0. Results are sorted by id;
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
begin
|
1131
|
+
# View devices
|
1132
|
+
result = api_instance.get_players(app_id, opts)
|
1133
|
+
p result
|
1134
|
+
rescue OneSignal::ApiError => e
|
1135
|
+
puts "Error when calling DefaultApi->get_players: #{e}"
|
1136
|
+
end
|
1137
|
+
```
|
1138
|
+
|
1139
|
+
#### Using the get_players_with_http_info variant
|
1140
|
+
|
1141
|
+
This returns an Array which contains the response data, status code and headers.
|
1142
|
+
|
1143
|
+
> <Array(<PlayerSlice>, Integer, Hash)> get_players_with_http_info(app_id, opts)
|
1144
|
+
|
1145
|
+
```ruby
|
1146
|
+
begin
|
1147
|
+
# View devices
|
1148
|
+
data, status_code, headers = api_instance.get_players_with_http_info(app_id, opts)
|
1149
|
+
p status_code # => 2xx
|
1150
|
+
p headers # => { ... }
|
1151
|
+
p data # => <PlayerSlice>
|
1152
|
+
rescue OneSignal::ApiError => e
|
1153
|
+
puts "Error when calling DefaultApi->get_players_with_http_info: #{e}"
|
1154
|
+
end
|
1155
|
+
```
|
1156
|
+
|
1157
|
+
### Parameters
|
1158
|
+
|
1159
|
+
| Name | Type | Description | Notes |
|
1160
|
+
| ---- | ---- | ----------- | ----- |
|
1161
|
+
| **app_id** | **String** | The app ID that you want to view players from | |
|
1162
|
+
| **limit** | **String** | How many devices to return. Max is 300. Default is 300 | [optional] |
|
1163
|
+
| **offset** | **Integer** | Result offset. Default is 0. Results are sorted by id; | [optional] |
|
1164
|
+
|
1165
|
+
### Return type
|
1166
|
+
|
1167
|
+
[**PlayerSlice**](PlayerSlice.md)
|
1168
|
+
|
1169
|
+
### Authorization
|
1170
|
+
|
1171
|
+
[app_key](../README.md#app_key)
|
1172
|
+
|
1173
|
+
### HTTP request headers
|
1174
|
+
|
1175
|
+
- **Content-Type**: Not defined
|
1176
|
+
- **Accept**: application/json
|
1177
|
+
|
1178
|
+
|
1179
|
+
## update_app
|
1180
|
+
|
1181
|
+
> <App> update_app(app_id, app)
|
1182
|
+
|
1183
|
+
Update an app
|
1184
|
+
|
1185
|
+
Updates the name or configuration settings of an existing OneSignal app
|
1186
|
+
|
1187
|
+
### Examples
|
1188
|
+
|
1189
|
+
```ruby
|
1190
|
+
require 'time'
|
1191
|
+
require 'onesignal'
|
1192
|
+
# setup authorization
|
1193
|
+
OneSignal.configure do |config|
|
1194
|
+
# Configure Bearer authorization: user_key
|
1195
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
api_instance = OneSignal::DefaultApi.new
|
1199
|
+
app_id = 'app_id_example' # String | An app id
|
1200
|
+
app = OneSignal::App.new({id: 'id_example'}) # App |
|
1201
|
+
|
1202
|
+
begin
|
1203
|
+
# Update an app
|
1204
|
+
result = api_instance.update_app(app_id, app)
|
1205
|
+
p result
|
1206
|
+
rescue OneSignal::ApiError => e
|
1207
|
+
puts "Error when calling DefaultApi->update_app: #{e}"
|
1208
|
+
end
|
1209
|
+
```
|
1210
|
+
|
1211
|
+
#### Using the update_app_with_http_info variant
|
1212
|
+
|
1213
|
+
This returns an Array which contains the response data, status code and headers.
|
1214
|
+
|
1215
|
+
> <Array(<App>, Integer, Hash)> update_app_with_http_info(app_id, app)
|
1216
|
+
|
1217
|
+
```ruby
|
1218
|
+
begin
|
1219
|
+
# Update an app
|
1220
|
+
data, status_code, headers = api_instance.update_app_with_http_info(app_id, app)
|
1221
|
+
p status_code # => 2xx
|
1222
|
+
p headers # => { ... }
|
1223
|
+
p data # => <App>
|
1224
|
+
rescue OneSignal::ApiError => e
|
1225
|
+
puts "Error when calling DefaultApi->update_app_with_http_info: #{e}"
|
1226
|
+
end
|
1227
|
+
```
|
1228
|
+
|
1229
|
+
### Parameters
|
1230
|
+
|
1231
|
+
| Name | Type | Description | Notes |
|
1232
|
+
| ---- | ---- | ----------- | ----- |
|
1233
|
+
| **app_id** | **String** | An app id | |
|
1234
|
+
| **app** | [**App**](App.md) | | |
|
1235
|
+
|
1236
|
+
### Return type
|
1237
|
+
|
1238
|
+
[**App**](App.md)
|
1239
|
+
|
1240
|
+
### Authorization
|
1241
|
+
|
1242
|
+
[user_key](../README.md#user_key)
|
1243
|
+
|
1244
|
+
### HTTP request headers
|
1245
|
+
|
1246
|
+
- **Content-Type**: application/json
|
1247
|
+
- **Accept**: application/json
|
1248
|
+
|
1249
|
+
|
1250
|
+
## update_player
|
1251
|
+
|
1252
|
+
> <InlineResponse2001> update_player(player_id, player)
|
1253
|
+
|
1254
|
+
Edit device
|
1255
|
+
|
1256
|
+
Update an existing device in one of your OneSignal apps
|
1257
|
+
|
1258
|
+
### Examples
|
1259
|
+
|
1260
|
+
```ruby
|
1261
|
+
require 'time'
|
1262
|
+
require 'onesignal'
|
1263
|
+
# setup authorization
|
1264
|
+
OneSignal.configure do |config|
|
1265
|
+
# Configure Bearer authorization: app_key
|
1266
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
api_instance = OneSignal::DefaultApi.new
|
1270
|
+
player_id = 'player_id_example' # String | Player's OneSignal ID
|
1271
|
+
player = OneSignal::Player.new({id: 'id_example', app_id: 'app_id_example', device_type: 37}) # Player |
|
1272
|
+
|
1273
|
+
begin
|
1274
|
+
# Edit device
|
1275
|
+
result = api_instance.update_player(player_id, player)
|
1276
|
+
p result
|
1277
|
+
rescue OneSignal::ApiError => e
|
1278
|
+
puts "Error when calling DefaultApi->update_player: #{e}"
|
1279
|
+
end
|
1280
|
+
```
|
1281
|
+
|
1282
|
+
#### Using the update_player_with_http_info variant
|
1283
|
+
|
1284
|
+
This returns an Array which contains the response data, status code and headers.
|
1285
|
+
|
1286
|
+
> <Array(<InlineResponse2001>, Integer, Hash)> update_player_with_http_info(player_id, player)
|
1287
|
+
|
1288
|
+
```ruby
|
1289
|
+
begin
|
1290
|
+
# Edit device
|
1291
|
+
data, status_code, headers = api_instance.update_player_with_http_info(player_id, player)
|
1292
|
+
p status_code # => 2xx
|
1293
|
+
p headers # => { ... }
|
1294
|
+
p data # => <InlineResponse2001>
|
1295
|
+
rescue OneSignal::ApiError => e
|
1296
|
+
puts "Error when calling DefaultApi->update_player_with_http_info: #{e}"
|
1297
|
+
end
|
1298
|
+
```
|
1299
|
+
|
1300
|
+
### Parameters
|
1301
|
+
|
1302
|
+
| Name | Type | Description | Notes |
|
1303
|
+
| ---- | ---- | ----------- | ----- |
|
1304
|
+
| **player_id** | **String** | Player's OneSignal ID | |
|
1305
|
+
| **player** | [**Player**](Player.md) | | |
|
1306
|
+
|
1307
|
+
### Return type
|
1308
|
+
|
1309
|
+
[**InlineResponse2001**](InlineResponse2001.md)
|
1310
|
+
|
1311
|
+
### Authorization
|
1312
|
+
|
1313
|
+
[app_key](../README.md#app_key)
|
1314
|
+
|
1315
|
+
### HTTP request headers
|
1316
|
+
|
1317
|
+
- **Content-Type**: application/json
|
1318
|
+
- **Accept**: application/json
|
1319
|
+
|
1320
|
+
|
1321
|
+
## update_player_tags
|
1322
|
+
|
1323
|
+
> <InlineResponse2003> update_player_tags(app_id, external_user_id, opts)
|
1324
|
+
|
1325
|
+
Edit tags with external user id
|
1326
|
+
|
1327
|
+
Update an existing device's tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device's tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" }
|
1328
|
+
|
1329
|
+
### Examples
|
1330
|
+
|
1331
|
+
```ruby
|
1332
|
+
require 'time'
|
1333
|
+
require 'onesignal'
|
1334
|
+
# setup authorization
|
1335
|
+
OneSignal.configure do |config|
|
1336
|
+
# Configure Bearer authorization: app_key
|
1337
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
1338
|
+
end
|
1339
|
+
|
1340
|
+
api_instance = OneSignal::DefaultApi.new
|
1341
|
+
app_id = 'app_id_example' # String | The OneSignal App ID the user record is found under.
|
1342
|
+
external_user_id = 'external_user_id_example' # String | The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated.
|
1343
|
+
opts = {
|
1344
|
+
update_player_tags_request_body: OneSignal::UpdatePlayerTagsRequestBody.new # UpdatePlayerTagsRequestBody |
|
1345
|
+
}
|
1346
|
+
|
1347
|
+
begin
|
1348
|
+
# Edit tags with external user id
|
1349
|
+
result = api_instance.update_player_tags(app_id, external_user_id, opts)
|
1350
|
+
p result
|
1351
|
+
rescue OneSignal::ApiError => e
|
1352
|
+
puts "Error when calling DefaultApi->update_player_tags: #{e}"
|
1353
|
+
end
|
1354
|
+
```
|
1355
|
+
|
1356
|
+
#### Using the update_player_tags_with_http_info variant
|
1357
|
+
|
1358
|
+
This returns an Array which contains the response data, status code and headers.
|
1359
|
+
|
1360
|
+
> <Array(<InlineResponse2003>, Integer, Hash)> update_player_tags_with_http_info(app_id, external_user_id, opts)
|
1361
|
+
|
1362
|
+
```ruby
|
1363
|
+
begin
|
1364
|
+
# Edit tags with external user id
|
1365
|
+
data, status_code, headers = api_instance.update_player_tags_with_http_info(app_id, external_user_id, opts)
|
1366
|
+
p status_code # => 2xx
|
1367
|
+
p headers # => { ... }
|
1368
|
+
p data # => <InlineResponse2003>
|
1369
|
+
rescue OneSignal::ApiError => e
|
1370
|
+
puts "Error when calling DefaultApi->update_player_tags_with_http_info: #{e}"
|
1371
|
+
end
|
1372
|
+
```
|
1373
|
+
|
1374
|
+
### Parameters
|
1375
|
+
|
1376
|
+
| Name | Type | Description | Notes |
|
1377
|
+
| ---- | ---- | ----------- | ----- |
|
1378
|
+
| **app_id** | **String** | The OneSignal App ID the user record is found under. | |
|
1379
|
+
| **external_user_id** | **String** | The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. | |
|
1380
|
+
| **update_player_tags_request_body** | [**UpdatePlayerTagsRequestBody**](UpdatePlayerTagsRequestBody.md) | | [optional] |
|
1381
|
+
|
1382
|
+
### Return type
|
1383
|
+
|
1384
|
+
[**InlineResponse2003**](InlineResponse2003.md)
|
1385
|
+
|
1386
|
+
### Authorization
|
1387
|
+
|
1388
|
+
[app_key](../README.md#app_key)
|
1389
|
+
|
1390
|
+
### HTTP request headers
|
1391
|
+
|
1392
|
+
- **Content-Type**: application/json
|
1393
|
+
- **Accept**: application/json
|
1394
|
+
|