dambel

دمبل

shevron
ورود | ثبت نام

API Docs / posts / update



PUT /api/v1/posts/{post-id}

Updates a post by its ID. All parameters are optional; only provided fields will be updated. You can set fields to null to clear them.


Permissions

PermissionDescription
posts.updateUpdate your own post
posts.update_anyUpdate any post (admin only)

Path Parameters

NameTypeRequiredDescriptionExample
post-idintYesID of the post to update123

Request Body Parameters

NameTypeRequiredDescriptionExample
titlestringNoTitle of the post (max 255 characters)"My Workout"
contentstringNoContent of the post (max 255 characters)"Did squats..."
is_draftboolNoWhether the post is a draftfalse
in_blogboolNoPublish the post on the website blog. Only users with posts.update_any permission can do itfalse

Request Example

{
  "title": "My Workout",
  "content": "Did squats and deadlifts.",
  "is_draft": false
}

Response

200 OK

Returns the updated post resource.

Example

{
  "post": {
    "id": 123,
    "profile_type": "App\\Models\\User",
    "profile_id": 42,
    "title": "My Workout",
    "content": "Did squats and deadlifts.",
    "is_draft": false
  }
}

For a full schema, see Post Resource.


Error Responses

StatusDescriptionReference
422Validation errorValidation error
401UnauthorizedAuthentication error
403Forbidden (no permission)Permission error
footer wave
logo

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutube