Example of Updating a Post via Postman and Application Password
In this note, we will update the post title using the WP REST API, using the Postman program and WordPress application passwords.
Step 1. Creating an Application Password
Go to your profile (or another user's profile), enter any application name, and click "Add new application password".
Remember that this functionality is only available when the site is using the https protocol.
Step 2. Updating the Post via Postman
Open the program and form a request for updating a post using the WP REST API. Let's say our post has ID=31, then the program settings will be as follows:
- URL -
https://wp-test.ru/wp-json/wp/v2/posts/31
- Type (method) of request - POST
Body tab (form-data or x-www-form-urlencoded)
Authentication tab
- type = Basic Auth
- Username = campusboy
- Password = mgF9 44Yx pDoY aTI0 haUc gEvh
Send the request - click the SEND button
When sending the request, various response options are possible:
-
If the user has sufficient rights to update the specified post, the post will be updated - a json will be returned, which is returned when requesting a post using the WP REST API, but it will already contain the updated title, and the server will respond with 200.
-
If the application password was revoked or entered incorrectly, an error "The specified password is not a valid application password" will be returned and the server will respond with 401.
-
If the application login and password belong to a user who does not have the right to update the specified post, we will receive an error "Sorry, you are not allowed to edit this post" and the server will respond with 403.