-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordpress-api.http
More file actions
281 lines (209 loc) · 7.31 KB
/
wordpress-api.http
File metadata and controls
281 lines (209 loc) · 7.31 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
### WordPress REST API Tests
### Base URL: http://localhost:3001
### Make sure your server is running and WordPress credentials are configured
###############################################################################
### POSTS
###############################################################################
### List all posts
GET http://localhost:3001/api/wordpress/posts
### List posts with filters
GET http://localhost:3001/api/wordpress/posts?per_page=5&status=publish&search=test
### Get specific post by ID
GET http://localhost:3001/api/wordpress/posts/1
### Create a new post (draft)
POST http://localhost:3001/api/wordpress/posts
Content-Type: application/json
{
"title": "Test Post from API",
"content": "This is a test post created via the REST API.",
"status": "draft",
"excerpt": "A brief excerpt of the test post"
}
### Create a post with categories and tags
POST http://localhost:3001/api/wordpress/posts
Content-Type: application/json
{
"title": "Post with Taxonomies",
"content": "This post has categories and tags assigned.",
"status": "draft",
"categories": [1, 2],
"tags": [3, 4]
}
### Update a post
PUT http://localhost:3001/api/wordpress/posts/1
Content-Type: application/json
{
"title": "Updated Post Title",
"status": "publish"
}
### Delete a post (move to trash)
DELETE http://localhost:3001/api/wordpress/posts/123
### Delete a post permanently
DELETE http://localhost:3001/api/wordpress/posts/123?force=true
###############################################################################
### PAGES
###############################################################################
### List all pages
GET http://localhost:3001/api/wordpress/pages
### List pages with filters
GET http://localhost:3001/api/wordpress/pages?per_page=10&status=publish
### Get specific page by ID
GET http://localhost:3001/api/wordpress/pages/2
### Create a new page
POST http://localhost:3001/api/wordpress/pages
Content-Type: application/json
{
"title": "Test Page",
"content": "This is a test page created via the REST API.",
"status": "draft"
}
### Create a child page
POST http://localhost:3001/api/wordpress/pages
Content-Type: application/json
{
"title": "Child Page",
"content": "This is a child page.",
"status": "draft",
"parent": 2
}
### Update a page
PUT http://localhost:3001/api/wordpress/pages/2
Content-Type: application/json
{
"title": "Updated Page Title",
"content": "Updated page content"
}
### Delete a page (move to trash)
DELETE http://localhost:3001/api/wordpress/pages/456
### Delete a page permanently
DELETE http://localhost:3001/api/wordpress/pages/456?force=true
###############################################################################
### CATEGORIES
###############################################################################
### List all categories
GET http://localhost:3001/api/wordpress/categories
### List categories (exclude empty)
GET http://localhost:3001/api/wordpress/categories?hide_empty=true
### Search categories
GET http://localhost:3001/api/wordpress/categories?search=technology
### Create a new category
POST http://localhost:3001/api/wordpress/categories
Content-Type: application/json
{
"name": "Technology",
"description": "Posts about technology and innovation"
}
### Create a child category
POST http://localhost:3001/api/wordpress/categories
Content-Type: application/json
{
"name": "Web Development",
"description": "Web development related posts",
"parent": 1
}
###############################################################################
### TAGS
###############################################################################
### List all tags
GET http://localhost:3001/api/wordpress/tags
### List tags (exclude empty)
GET http://localhost:3001/api/wordpress/tags?hide_empty=true
### Search tags
GET http://localhost:3001/api/wordpress/tags?search=javascript
### Create a new tag
POST http://localhost:3001/api/wordpress/tags
Content-Type: application/json
{
"name": "JavaScript",
"description": "JavaScript programming language"
}
### Create another tag
POST http://localhost:3001/api/wordpress/tags
Content-Type: application/json
{
"name": "React",
"description": "React library for building UIs"
}
###############################################################################
### MEDIA
###############################################################################
### List all media
GET http://localhost:3001/api/wordpress/media
### List images only
GET http://localhost:3001/api/wordpress/media?media_type=image
### List videos only
GET http://localhost:3001/api/wordpress/media?media_type=video
### Search media
GET http://localhost:3001/api/wordpress/media?search=logo
### Get specific media item by ID
GET http://localhost:3001/api/wordpress/media/10
###############################################################################
### COMMENTS
###############################################################################
### List all comments
GET http://localhost:3001/api/wordpress/comments
### List comments for specific post
GET http://localhost:3001/api/wordpress/comments?post=1
### List approved comments only
GET http://localhost:3001/api/wordpress/comments?status=approved
### Create a new comment
POST http://localhost:3001/api/wordpress/comments
Content-Type: application/json
{
"post": 1,
"content": "This is a test comment from the REST API.",
"author_name": "Test User",
"author_email": "test@example.com"
}
###############################################################################
### USERS
###############################################################################
### List all users
GET http://localhost:3001/api/wordpress/users
### Search users
GET http://localhost:3001/api/wordpress/users?search=john
### List users by role
GET http://localhost:3001/api/wordpress/users?roles=administrator
### List users with pagination
GET http://localhost:3001/api/wordpress/users?per_page=5&page=1
###############################################################################
### PLUGINS
###############################################################################
### List all plugins
GET http://localhost:3001/api/wordpress/plugins
### List active plugins only
GET http://localhost:3001/api/wordpress/plugins?status=active
### List inactive plugins only
GET http://localhost:3001/api/wordpress/plugins?status=inactive
### Search plugins
GET http://localhost:3001/api/wordpress/plugins?search=akismet
### Get specific plugin by slug
GET http://localhost:3001/api/wordpress/plugins/akismet%2Fakismet.php
### Install a plugin from WordPress.org (inactive by default)
POST http://localhost:3001/api/wordpress/plugins
Content-Type: application/json
{
"slug": "classic-editor",
"status": "inactive"
}
### Install and activate a plugin
POST http://localhost:3001/api/wordpress/plugins
Content-Type: application/json
{
"slug": "contact-form-7",
"status": "active"
}
### Activate a plugin
PUT http://localhost:3001/api/wordpress/plugins/user-role-editor%2Fuser-role-editor
Content-Type: application/json
{
"status": "active"
}
### Deactivate a plugin
PUT http://localhost:3001/api/wordpress/plugins/user-role-editor%2Fuser-role-editor
Content-Type: application/json
{
"status": "inactive"
}
### Delete/uninstall a plugin (must be inactive first)
DELETE http://localhost:3001/api/wordpress/plugins/user-role-editor%2Fuser-role-editor