Update a post
Edit a post with PUT /posts/{id}. Send only the fields you want to change.
Edits a post. Send only the fields you want to change. Everything else stays as it is.
Request
| Item | Value |
|---|---|
| Method · path | PUT /posts/{id} |
| Permission | Drafts: Write only (write) or higher. Published or scheduled posts: Full access (publish) |
Changes to a published post go live on your blog as soon as you save.
Request fields
The fields are the same as in Create an empty post (draft), and all are optional.
- Fields you leave out or send as
nullkeep their current value. - To clear a value, send
""for strings and[]for lists. tagsandcategoriesare replaced with the list you send. To add one item, send the existing values along with it.- Content can't be emptied. If you send an empty
content, the existing content stays. langcan't be changed. Create a new post for another language version.- A published post's
slugcan't be changed. - Send
externalIdto set or change it, or send""to remove it.
Example
curl -X PUT https://api-open.weekerp.com/blog/v1/posts/0193a1f2-7c4e-7b8a-9d10-3f2c1b0a9e87 \
-H "Authorization: Bearer wk_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "title": "6 Spring tips", "tags": ["spring", "java", "tips"] }'
Response
You get 200 with the full updated post.
Common errors
| HTTP | code | Fix |
|---|---|---|
| 404 | post_not_found |
Check the post ID. Posts on other blogs can't be found |
| 403 | api_key_scope_insufficient |
Use a full-access key to edit published posts |
| 400 | invalid_value |
You tried to change lang, or a value is in the wrong format |
| 409 | post_slug_immutable |
A published post's slug can't be changed |
| 409 | post_slug_duplicated |
The same slug already exists in that language |
| 400 | post_content_unsafe |
The content contains executable HTML |
For the full list of errors, see Error format in Publish posts with the blog API.