update readme.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-10-23 22:01:08 +08:00
parent 81f37465b0
commit f42d9e2ee3
1 changed files with 49 additions and 48 deletions

View File

@ -363,57 +363,58 @@ See more example about [iOS](#ios-example) or [Android](#android-example).
Request body must has a notifications array. The following is a parameter table for each notification. Request body must has a notifications array. The following is a parameter table for each notification.
|name|type|description|required|note| | name | type | description | required | note |
|-------|-------|--------|--------|---------| |-------------------------|--------------|---------------------------------------------------------------------------------------------------|----------|---------------------------------------------------------------|
|tokens|string array|device tokens|o|| | tokens | string array | device tokens | o | |
|platform|int|platform(iOS,Android)|o|1=iOS, 2=Android| | platform | int | platform(iOS,Android) | o | 1=iOS, 2=Android |
|message|string|message for notification|o|| | message | string | message for notification | o | |
|title|string|notification title|-|| | title | string | notification title | - | |
|priority|string|Sets the priority of the message.|-|`normal` or `high`| | priority | string | Sets the priority of the message. | - | `normal` or `high` |
|content_available|bool|data messages wake the app by default.|-|| | content_available | bool | data messages wake the app by default. | - | |
|sound|string|sound type|-|| | sound | string | sound type | - | |
|data|string array|extensible partition|-|| | data | string array | extensible partition | - | |
|api_key|string|Android api key|-|only Android| | retry | int | retry send notification if fail response from server. Value must be small than `max_retry` field. | - | |
|to|string|The value must be a registration token, notification key, or topic.|-|only Android| | api_key | string | Android api key | - | only Android |
|collapse_key|string|a key for collapsing notifications|-|only Android| | to | string | The value must be a registration token, notification key, or topic. | - | only Android |
|delay_while_idle|bool|a flag for device idling|-|only Android| | collapse_key | string | a key for collapsing notifications | - | only Android |
|time_to_live|uint|expiration of message kept on GCM storage|-|only Android| | delay_while_idle | bool | a flag for device idling | - | only Android |
|restricted_package_name|string|the package name of the application|-|only Android| | time_to_live | uint | expiration of message kept on GCM storage | - | only Android |
|dry_run|bool|allows developers to test a request without actually sending a message|-|only Android| | restricted_package_name | string | the package name of the application | - | only Android |
|notification|string array|payload of a GCM message|-|only Android. See the [detail](#android-notification-payload)| | dry_run | bool | allows developers to test a request without actually sending a message | - | only Android |
|expiration|int|expiration for notification|-|only iOS| | notification | string array | payload of a GCM message | - | only Android. See the [detail](#android-notification-payload) |
|apns_id|string|A canonical UUID that identifies the notification|-|only iOS| | expiration | int | expiration for notification | - | only iOS |
|topic|string|topic of the remote notification|-|only iOS| | apns_id | string | A canonical UUID that identifies the notification | - | only iOS |
|badge|int|badge count|-|only iOS| | topic | string | topic of the remote notification | - | only iOS |
|category|string|the UIMutableUserNotificationCategory object|-|only iOS| | badge | int | badge count | - | only iOS |
|alert|string array|payload of a iOS message|-|only iOS. See the [detail](#ios-alert-payload)| | category | string | the UIMutableUserNotificationCategory object | - | only iOS |
| alert | string array | payload of a iOS message | - | only iOS. See the [detail](#ios-alert-payload) |
### iOS alert payload ### iOS alert payload
|name|type|description|required|note| | name | type | description | required | note |
|-------|-------|--------|--------|---------| |----------------|------------------|--------------------------------------------------------------------------------------------------|----------|------|
|action|string|The label of the action button. This one is required for Safari Push Notifications.|-|| | action | string | The label of the action button. This one is required for Safari Push Notifications. | - | |
|action-loc-key|string|If a string is specified, the system displays an alert that includes the Close and View buttons.|-|| | action-loc-key | string | If a string is specified, the system displays an alert that includes the Close and View buttons. | - | |
|launch-image|string|The filename of an image file in the app bundle, with or without the filename extension.|-|| | launch-image | string | The filename of an image file in the app bundle, with or without the filename extension. | - | |
|loc-args|array of strings|Variable string values to appear in place of the format specifiers in loc-key.|-|| | loc-args | array of strings | Variable string values to appear in place of the format specifiers in loc-key. | - | |
|loc-key|string|A key to an alert-message string in a Localizable.strings file for the current localization.|-|| | loc-key | string | A key to an alert-message string in a Localizable.strings file for the current localization. | - | |
|title-loc-args|array of strings|Variable string values to appear in place of the format specifiers in title-loc-key.|-|| | title-loc-args | array of strings | Variable string values to appear in place of the format specifiers in title-loc-key. | - | |
|title-loc-key|string|The key to a title string in the Localizable.strings file for the current localization.|-|| | title-loc-key | string | The key to a title string in the Localizable.strings file for the current localization. | - | |
See more detail about [APNs Remote Notification Payload](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH107-SW1). See more detail about [APNs Remote Notification Payload](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH107-SW1).
### Android notification payload ### Android notification payload
|name|type|description|required|note| | name | type | description | required | note |
|-------|-------|--------|--------|---------| |----------------|--------|-----------------------------------------------------------------------------------------------------------|----------|------|
|icon|string|Indicates notification icon.|-|| | icon | string | Indicates notification icon. | - | |
|tag|string|Indicates whether each notification message results in a new entry on the notification center on Android.|-|| | tag | string | Indicates whether each notification message results in a new entry on the notification center on Android. | - | |
|color|string|Indicates color of the icon, expressed in #rrggbb format|-|| | color | string | Indicates color of the icon, expressed in #rrggbb format | - | |
|click_action|string|The action associated with a user click on the notification.|-|| | click_action | string | The action associated with a user click on the notification. | - | |
|body_loc_key|string|Indicates the key to the body string for localization.|-|| | body_loc_key | string | Indicates the key to the body string for localization. | - | |
|body_loc_args|string|Indicates the string value to replace format specifiers in body string for localization.|-|| | body_loc_args | string | Indicates the string value to replace format specifiers in body string for localization. | - | |
|title_loc_key|string|Indicates the key to the title string for localization.|-|| | title_loc_key | string | Indicates the key to the title string for localization. | - | |
|title_loc_args|string|Indicates the string value to replace format specifiers in title string for localization.|-|| | title_loc_args | string | Indicates the string value to replace format specifiers in title string for localization. | - | |
See more detail about [GCM server reference](https://developers.google.com/cloud-messaging/http-server-ref#send-downstream). See more detail about [GCM server reference](https://developers.google.com/cloud-messaging/http-server-ref#send-downstream).
@ -518,11 +519,11 @@ Add other fields which user defined via `data` field.
Error response message table: Error response message table:
|status code|message| | status code | message |
|-------|-------| |-------------|--------------------------------------------|
|400|Missing `notifications` field.| | 400 | Missing `notifications` field. |
|400|Notifications field is empty.| | 400 | Notifications field is empty. |
|400|Number of notifications(50) over limit(10)| | 400 | Number of notifications(50) over limit(10) |
Success response: Success response: