OLD | NEW |
1 <meta name="doc-family" content="apps"> | 1 <meta name="doc-family" content="apps"> |
2 <h1>API Reference for GCM service</h1> | 2 <h1>API Reference for GCM service</h1> |
3 | 3 |
4 <p> | 4 <p> |
5 The <a href="cloudMessaging.html">Google Cloud Messaging for Chrome</a> service | 5 The <a href="cloudMessaging.html">Google Cloud Messaging for Chrome</a> service |
6 sends messages to users of a Chrome packaged app. | 6 sends messages to users of a Chrome packaged app. |
7 The service handles all aspects of queueing and delivering messages. | 7 The service handles all aspects of queueing and delivering messages. |
8 To use the service, | 8 To use the service, |
9 you must agree to the | 9 you must agree to the |
10 <a href="gcm_tos.html">Google Cloud Messaging for Chrome API Terms of Service</a
>. | 10 <a href="gcm_tos.html">Google Cloud Messaging for Chrome API Terms of Service</a
>. |
11 </p> | 11 </p> |
12 | 12 |
13 <p>Messages must conform to these constraints:</p> | 13 <p>Messages must conform to these constraints:</p> |
14 | 14 |
15 <ul> | 15 <ul> |
16 <li><strong>Maximum payload length:</strong> 256 bytes</li> | 16 <li><strong>Maximum payload length:</strong> 256 bytes</li> |
17 <li><strong>Maxium subchannels:</strong> 4</li> | 17 <li><strong>Maxium subchannels:</strong> 4</li> |
18 <li><strong>Maximum API requests per day:</strong> 10,000</li> | 18 <li><strong>Maximum API requests per day:</strong> 10,000</li> |
19 </ul> | 19 </ul> |
20 | 20 |
21 <h2 id="libraries">Google API client libraries</h2> | 21 <h2 id="libraries">Google API client libraries</h2> |
22 | 22 |
23 <p> | 23 <p> |
24 You may use the REST interface defined here | 24 You may use the REST interface defined here |
25 to access Google Cloud Messaging for Chrome from your application. | 25 to access Google Cloud Messaging for Chrome from your application. |
26 We also offer Google API client libraries for a number | 26 We also offer Google API client libraries for a number |
27 of popular programming languages that can be used to access the API. | 27 of popular programming languages that can be used to access the API. |
28 For more information, see | 28 For more information, see |
29 <a href="https://developers.google.com/api-client-library">https://developers.go
ogle.com/api-client-library</a>. | 29 <a href="https://developers.google.com/api-client-library">Google APIs Client Li
braries</a>. |
30 </p> | 30 </p> |
31 | 31 |
32 <h2 id="insert">Insert method</h2> | 32 <h2 id="insert">Insert method</h2> |
33 | 33 |
34 <p> | 34 <p> |
35 The <code>gcm_for_chrome.messages.insert</code> | 35 The <code>gcm_for_chrome.messages.insert</code> |
36 method sends a message to your app or extension user. | 36 method sends a message to your app or extension user. |
37 </p> | 37 </p> |
38 | 38 |
39 <h2 id="authorization">Authentication</h3> | 39 <h2 id="authorization">Authentication</h3> |
(...skipping 17 matching lines...) Expand all Loading... |
57 </p> | 57 </p> |
58 | 58 |
59 <table> | 59 <table> |
60 <tr> | 60 <tr> |
61 <th scope="col">Parameter</th> | 61 <th scope="col">Parameter</th> |
62 <th scope="col">Description</th> | 62 <th scope="col">Description</th> |
63 </tr> | 63 </tr> |
64 <tr> | 64 <tr> |
65 <td><code>client_id</code></td> | 65 <td><code>client_id</code></td> |
66 <td>Indicates the app or extension client that is making the request. | 66 <td>Indicates the app or extension client that is making the request. |
67 Obtained from the <a href="https://code.google.com/apis/console/">Google API
s console</a>; | 67 Obtained from the <a href="https://code.google.com/apis/console/">Google API
s Console</a>; |
68 the parameter value must exactly match the client ID shown | 68 the parameter value must exactly match the client ID shown |
69 in the console. | 69 in the console. |
70 </td> | 70 </td> |
71 </tr> | 71 </tr> |
72 <tr> | 72 <tr> |
73 <td><code>client_secret</code></td> | 73 <td><code>client_secret</code></td> |
74 <td>The client secret obtained during registration in | 74 <td>The client secret obtained during registration in |
75 » <a href="https://code.google.com/apis/console/">Google APIs console</a>.
</td> | 75 » <a href="https://code.google.com/apis/console/">Google APIs Console</a>.
</td> |
76 </tr> | 76 </tr> |
77 <tr> | 77 <tr> |
78 <td><code>refresh_token</code></td> | 78 <td><code>refresh_token</code></td> |
79 <td>Token associated with app or extension used to obtain new access token.<
/td> | 79 <td>Token associated with app or extension used to obtain new access token.<
/td> |
80 </tr> | 80 </tr> |
81 <tr> | 81 <tr> |
82 <td><code>grant_type</code></td> | 82 <td><code>grant_type</code></td> |
83 <td>The <code>authorization_code</code> value of <code>refresh_token</code>.
</td> | 83 <td>The <code>authorization_code</code> value of <code>refresh_token</code>.
</td> |
84 </tr> | 84 </tr> |
85 </table> | 85 </table> |
86 | 86 |
87 <h3 id="response">Response</h3> | 87 <h3 id="response">Response</h3> |
88 | 88 |
| 89 <p> |
89 The authorization response includes: | 90 The authorization response includes: |
| 91 </p> |
90 | 92 |
91 <table> | 93 <table> |
92 <tr> | 94 <tr> |
93 <th scope="col">Field</th> | 95 <th scope="col">Field</th> |
94 <th scope="col">Description</th> | 96 <th scope="col">Description</th> |
95 </tr> | 97 </tr> |
96 <tr> | 98 <tr> |
97 <td><code>access_token</code></td> | 99 <td><code>access_token</code></td> |
98 <td>Valid token required to access the GCM for Chrome service.</td> | 100 <td>Valid token required to access the GCM for Chrome service.</td> |
99 </tr> | 101 </tr> |
100 <tr> | 102 <tr> |
101 <td><code>expires_in</code></td> | 103 <td><code>expires_in</code></td> |
102 <td>Time until access token expires in seconds.</td> | 104 <td>Time until access token expires in seconds.</td> |
103 </tr> | 105 </tr> |
104 <tr> | 106 <tr> |
105 <td><code>token_type</code></td> | 107 <td><code>token_type</code></td> |
106 <td>The returned token type, <code>Bearer</code>.</td> | 108 <td>The returned token type, <code>Bearer</code>.</td> |
107 </tr> | 109 </tr> |
108 </table> | 110 </table> |
109 | 111 |
110 <h2 id="request">Message request</h2> | 112 <h2 id="request">Message request</h2> |
111 | 113 |
112 <h3 id="http">HTTP request</h3> | 114 <h3 id="http">HTTP request</h3> |
113 | 115 |
114 <p><code>Post https://www.googleapis.com/gcm_for_chrome/v1/messages</code></p> | 116 <p><code>POST https://www.googleapis.com/gcm_for_chrome/v1/messages</code></p> |
115 | 117 |
116 <h3 id="body">Request body</h3> | 118 <h3 id="body">Request body</h3> |
117 | 119 |
| 120 <p> |
118 In the request body, supply: | 121 In the request body, supply: |
| 122 </p> |
119 | 123 |
120 <table> | 124 <table> |
121 <tr> | 125 <tr> |
122 <th scope="col">Parameter</th> | 126 <th scope="col">Parameter</th> |
123 <th scope="col">Description</th> | 127 <th scope="col">Description</th> |
124 </tr> | 128 </tr> |
125 <tr> | 129 <tr> |
126 <td><code>Content-Type</code></td> | 130 <td><code>Content-Type</code></td> |
127 <td>The request body content type, <code>application/json</code>.</td> | 131 <td>The request body content type, <code>application/json</code>.</td> |
128 </tr> | 132 </tr> |
(...skipping 10 matching lines...) Expand all Loading... |
139 <td><code>subchannelId</code></td> | 143 <td><code>subchannelId</code></td> |
140 <td>The subchannel to send the message on; only values 0-3 are valid.</td> | 144 <td>The subchannel to send the message on; only values 0-3 are valid.</td> |
141 </tr> | 145 </tr> |
142 <tr> | 146 <tr> |
143 <td><code>paylooad</code></td> | 147 <td><code>paylooad</code></td> |
144 <td>The message body (up to 256 bytes).</td> | 148 <td>The message body (up to 256 bytes).</td> |
145 </tr> | 149 </tr> |
146 </table> | 150 </table> |
147 | 151 |
148 <p class="backtotop"><a href="#top">Back to top</a></p> | 152 <p class="backtotop"><a href="#top">Back to top</a></p> |
OLD | NEW |