-
Notifications
You must be signed in to change notification settings - Fork 6
/
curl_command.txt
72 lines (58 loc) · 2.55 KB
/
curl_command.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# For sending notification
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -d '{
"notification": {
"title": "New Article",
"body": "Firebase Cloud Messaging for Web using JavaScript",
"icon": "alarm.png",
"click_action": "http://rakibul.net/fcm-web-js"
},
"to": "<your_client_token>"
}' "https://fcm.googleapis.com/fcm/send"
# Subscribe to a topic
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -H "Content-Length: 0" "https://iid.googleapis.com/iid/v1/instance_tokn/rel/topics/<topic_name>"
# Subscribe multiple client apps to a topic
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -d '{
"to": "/topics/<topic_name>",
"registration_tokens": ["<your_client_token>"]
}' "https://iid.googleapis.com/iid/v1:batchAdd"
# Unsubscribe multiple client apps from a topic
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -d '{
"to": "/topics/<topic_name>",
"registration_tokens": ["<your_client_token>"]
}' "https://iid.googleapis.com/iid/v1:batchRemove"
# Send notification messages to a topic
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -d '{
"notification": {
"title": "New Article",
"body": "Firebase Cloud Messaging for Web using JavaScript",
"icon": "alarm.png",
"click_action": "http://rakibul.net/fcm-web-js"
},
"to": "/topics/<topic_name>"
}' "https://fcm.googleapis.com/fcm/send"
# Send data messages to a topic
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -d '{
"data": {
"title": "New Article",
"body": "Firebase Cloud Messaging for Web using JavaScript",
"icon": "alarm.png",
"click_action": "http://rakibul.net/fcm-web-js"
},
"to": "/topics/<topic_name>"
}' "https://fcm.googleapis.com/fcm/send"
# Notification message with data payload
curl -X POST -H "Authorization: key=<your_server_key>" -H "Content-Type: application/json" -d '{
"notification": {
"title": "New Article",
"body": "Firebase Cloud Messaging for Web using JavaScript",
"icon": "alarm.png",
"click_action": "http://rakibul.net/fcm-web-js"
},
"data": {
"title": "rakibul.net",
"body": "This is a background notification"
},
"to": "/topics/<topic_name>"
}' "https://fcm.googleapis.com/fcm/send"
# Get information about client app
curl -X GET -H "Authorization: key=<your_server_key>" "https://iid.googleapis.com/iid/v1/<your_client_token>?details=true"