You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are three values that need to be set in order to use the library: your default OneSignal app ID, the REST API key and your account User Auth Key.
44
32
All of these items can be found in your Control Panel on the OneSignal site.
45
33
First two are app-related and can be found inside your app settings in the "Keys & IDs" tab (upper left corner), the third is account-related and can be found pressing your account avatar (lower right corner) and selecting "Account & API Keys".
46
34
47
35
Place the 3 keys into your .env file, as such:
36
+
48
37
```
49
38
ONESIGNAL_APP_ID=
50
39
ONESIGNAL_REST_API_KEY=
@@ -53,8 +42,9 @@ ONESIGNAL_USER_AUTH_KEY=
53
42
54
43
## Usage
55
44
56
-
There is a function for each of the OneSignal API calls. They are broken down here.
45
+
There is a function for each of the OneSignal API calls. They are broken down here.
57
46
All methods will return an array formatted like this:
47
+
58
48
```
59
49
[
60
50
'status' => < HTTP status code of the request >,
@@ -64,46 +54,48 @@ All methods will return an array formatted like this:
64
54
]
65
55
```
66
56
67
-
**Note:** In all instances where an $app_id is asked for, omitting it will grab the default OneSignal App ID specified in the .env file
57
+
**Note:** In all instances where an \$app_id is asked for, omitting it will grab the default OneSignal App ID specified in the .env file
68
58
69
59
### Apps
70
60
71
61
##### getApps() - Get all Apps for the user
62
+
72
63
```
73
64
$response = OneSignal::getApps();
74
65
```
75
66
76
-
##### getApp( $app_id ) - Get the given App
67
+
##### getApp( \$app_id ) - Get the given App
77
68
78
-
##### postapp( $data ) - Create a new App
69
+
##### postapp( \$data ) - Create a new App
79
70
80
71
##### putApp( $app_id, $data ) - Update an App
81
72
82
73
### Players
83
74
84
-
##### getPlayers( $app_id, $limit, $offset ) - Get Players from an App
75
+
##### getPlayers( $app_id, $limit, \$offset ) - Get Players from an App
85
76
86
-
##### getPlayer( $id ) - Get Player of the given ID
77
+
##### getPlayer( \$id ) - Get Player of the given ID
87
78
88
79
##### postPlayer ( $data, $app_id ) - Add Player to an App
89
80
90
81
##### putPlayer( $data, $app_id ) - Update Player object for an App
91
82
92
-
##### postCSVExport( $app_id ) - Get a CSV dump of all Players for an App
83
+
##### postCSVExport( \$app_id ) - Get a CSV dump of all Players for an App
93
84
94
-
##### postPlayerOnSession( $data ) - Start a new device session for this Player
85
+
##### postPlayerOnSession( \$data ) - Start a new device session for this Player
95
86
96
-
##### postPlayerOnPurchase( $data ) - Track a new purchase for this Player
87
+
##### postPlayerOnPurchase( \$data ) - Track a new purchase for this Player
97
88
98
-
##### postPlayerOnFocus( $data ) - Increment the Players total session length
89
+
##### postPlayerOnFocus( \$data ) - Increment the Players total session length
99
90
100
91
### Notifications
101
92
102
-
##### getNotifications( $app_id, $limit, $offset ) - Get all Notifications for an App
93
+
##### getNotifications( $app_id, $limit, \$offset ) - Get all Notifications for an App
103
94
104
95
##### getNotification( $id, $app_id ) - Get a Notification from an App
105
96
106
97
##### postNotification( $data, $app_id ) - Add a Notification to an App
0 commit comments