dambel

دمبل

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

API Docs / posts / create



POST /api/v1/posts

Creates a new post for a specified profile (gym or user).


Permissions

PermissionDescription
posts.createCreate posts for your own profiles

Request Body Parameters

NameTypeRequiredDescriptionExample
profile_typestringYesType of the profile (gym or user)"user"
profile_idintYesID of the profile to post to42
titlestringYesTitle of the post (max 255 characters)"My Workout"
contentstringYesContent of the post (max 255 characters)"Did squats..."
is_draftboolNoWhether the post is a draftfalse

Request Example

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

Response

201 Created

Returns the created 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