PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 4.3.5
Jetpack – WP Security, Backup, Speed, & Growth v4.3.5
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / rest-api.md
rest-api.md
256 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 # Jetpack HTTP API
2
3 Jetpack's HTTP API is built as an [](http://v2.wp-api.org/extending/adding/extension to the WP-API](http://v2.wp-api.org/extending/adding/](http://v2.wp-api.org/extending/adding/). Thus, you may find additional information on approaching the API in the [](http://v2.wp-api.org/WP API Docs](http://v2.wp-api.org/](http://v2.wp-api.org/).
4
5 ## API Authentication and authorization
6
7 The API requests rely on [](http://v2.wp-api.org/guide/authentication/#cookie-authenticationcookie-based authentication and a specific nonce](http://v2.wp-api.org/guide/authentication/#cookie-authentication](http://v2.wp-api.org/guide/authentication/#cookie-authentication)
8 for requests to be authorized.
9
10 ### API Request Authorization via nonces
11
12 The WP REST API infrastructure requires a nonce for authorizing of the request itself.
13
14 Ensure to use the `X-WP-Nonce` header on your request.
15
16 ```
17 X-WP-Nonce: e1cff122e1
18 ```
19
20 The nonce is being served on the Jetpack admin page by usage of the [](https://codex.wordpress.org/Function_Reference/wp_localize_scriptwp_localize_script](https://codex.wordpress.org/Function_Reference/wp_localize_script](https://codex.wordpress.org/Function_Reference/wp_localize_script) mechanism for passing values from PHP code to the JS scope. It's created for the action `wp_rest` and made available in the Jetpack Admin Page as:
21
22 ```
23 window.Initial_State.WP_API_nonce;
24 ```
25
26 The root URL for the the API is found on the same page as:
27
28 ```
29 window.Initial_State.WP_API_root;
30 ```
31
32 ## Discovery
33
34 WP-API-compatible [](http://v2.wp-api.org/guide/discovery/capabilities document](http://v2.wp-api.org/guide/discovery/](http://v2.wp-api.org/guide/discovery/) for the endpoints registered by Jetpack.
35
36 `GET /wp-json/jetpack/v4`
37
38 ## API Reference
39
40 All endpoints return and accept JSON. Make sure you add the proper `content-type` header to your PUT/POST requests sending JSON objects.
41
42 ```
43 'Content-type': 'application/json'
44 ```
45
46 ### Jetpack connection
47
48 Operations related to Jetpack's connection to WordPress.com
49
50 #### GET /wp-json/jetpack/v4/connection-status
51
52 Fetch Jetpack's current connection status.
53
54 #### GET /wp-json/jetpack/v4/connect-url
55
56 Fetch a fresh WordPress.com URL for connecting the Jetpack installation.
57
58 #### GET /wp-json/jetpack/v4/user-connection-data
59
60 Fetch the data of the current's user WordPress.com account.
61
62 #### POST /wp-json/jetpack/v4/disconnect/site
63
64 Disconnect the Jetpack installation from WordPress.com servers.
65
66 **This endpoint does not take Body parameters**
67
68 #### POST /wp-json/jetpack/v4/recheck-ssl
69
70 Check if the site has SSL enabled.
71
72 **This endpoint does not take Body parameters**
73
74 ### Jetpack modules
75
76 #### GET /wp-json/jetpack/v4/module/all
77
78 Get a list of all Jetpacks modules, its description, other properties and the module's options
79
80 #### GET /wp-json/jetpack/v4/module/:module-slug
81
82 Get a single module description and properties by its slug.
83
84 **URL parameters**
85
86 * `module-slug`: {String} The identifier of the module to get info about.
87
88 #### POST /wp-json/jetpack/v4/module/:module-slug/active
89
90 Activate or deactivate a module by its slug
91
92 Accepts a JSON object in the body like:
93 ```
94 {
95 "active": true
96 }
97 ```
98
99 **URL parameters**
100
101 * `module-slug`: {String} The identifier of the module on which to act.
102
103 **Body parameters**
104
105 * `active`: {Boolean} Send false to deactivate the module.
106
107
108 #### POST /wp-json/jetpack/v4/module/activate
109
110 Activate several modules at a time by their slug
111
112 **Body parameters**
113
114 * `modules`: {Array} An array of strings of identifiers of the modules to activate
115
116 ```
117 {
118 "modules": [ "protect", "monitor", "likes" ]
119 }
120 ```
121
122 #### POST /wp-json/jetpack/v4/module/:module-slug
123
124 Update an option's value for a module
125
126 **URL parameters**
127
128 * `module-slug`: {String} The identifier of the module on which to act.
129
130 **Body parameters**
131
132 * Accepts a simple object with the key of the option to update and the new value.
133
134 Accepts a JSON object in the body like:
135 ```
136 {
137 "option-key": "new-option-value"
138 }
139 ```
140
141 ### Jetpack miscellaneous settings
142
143 ### GET /wp-json/jetpack/v4/settings
144
145 Fetch a list of Jetpack settings not related to a particular module.
146
147 ### POST /wp-json/jetpack/v4/settings/update
148
149 Update a setting value
150
151 **Body parameters**
152
153 * Accepts a simple object with the key of the setting to update and the new value.
154
155 Accepts a JSON object in the body like:
156 ```
157 {
158 "setting-key": "new-setting-value"
159 }
160 ```
161
162 #### POST /wp-json/jetpack/v4/jumpstart/activate
163
164 Activate Jumpstart turning on some options and settings to a recommended state.
165
166 **This endpoint does not take Body parameters**
167
168 #### POST /wp-json/jetpack/v4/jumpstart/deactivate
169
170 Deactivate Jumpstart reverting options to their default state.
171
172 **This endpoint does not take Body parameters**
173
174 #### POST /wp-json/jetpack/v4/reset/:options_or_modules
175
176 Reset Jetpack module options or Jetpack modules activation state to default values.
177
178 **URL parameters**
179
180 * `options_or_modules`: {String} Available values:
181 * `"options"`: all the modules' options will be re-set to their default values.
182 * `"modules"`: the modules activation state will be reset to their defaults.
183
184 **This endpoint does not take Body parameters**
185
186
187 ### Users
188
189 Operations related to the site's users linked to WordPress.com accounts.
190
191 #### POST /wp-json/jetpack/v4/unlink
192
193 Unlink current user from the related WordPress.com account.
194
195 **This endpoint does not take Body parameters**
196
197 ### Site information
198
199 Operations related to information about the site.
200
201 ### Jetpack notices
202
203 #### POST /wp-json/jetpack/v4/notice/:notice/dismiss
204
205 Dismiss a Jetpack notice by Id.
206
207 **URL parameters**
208
209 * `notice`: {String} The identifier of the notice to dismiss. Possible values:
210 * `"feedback_dash_request"`
211 * `"welcome"`.
212
213 ** HTTP Status codes**
214
215 * `404` - When `:notice` is not valid or absent
216
217 #### GET /wp-json/jetpack/v4/site
218
219 Get current site data
220
221 ### Protect module related operations
222
223 ##### GET /wp-json/jetpack/v4/module/protect/count/get
224
225 Get count of blocked attacks by Protect.
226
227 ### Monitor module related operations
228
229 #### GET /wp-json/jetpack/v4/module/monitor/downtime/last
230
231 Get from the Monitor module, the last time the site was down.
232
233 ### Verification Tools module related operations
234
235 #### GET /wp-json/jetpack/v4/module/verification-tools/services
236
237 Get services that this site is verified with.
238
239 ### Site's plugins related operations
240
241 #### GET /wp-json/jetpack/v4/updates/plugins
242
243 Get number of updated available for currently installed WordPress plugins.
244
245 ### Akismet related operations
246
247 #### GET /wp-json/jetpack/v4/akismet/stats/get
248
249 Get stats from Akismet filtered spam.
250
251 ### VaultPress options
252
253 #### GET /wp-json/jetpack/v4/module/vaultpress/data
254
255 get date of last backup or status and information about actions for user to take.
256