dambel

دمبل

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

API Docs / media / create



POST /api/v1/media

Attach a media file to a specified element (e.g., gym, post, user).


Permissions

You must have update permission for the target attachable resource.


Request Body Parameters

NameTypeRequiredDescriptionExample
attachable_typestringYesType of the element to attach media to (see below)"gym"
attachable_idintYesID of the element42
filefileYesThe media file to upload(binary file)

Available attachable_type values:

  • championship
  • gym
  • gym_equipment
  • post
  • user
  • education
  • gym_buffet_item
  • training_service
  • tracker_meal

Request Example (multipart/form-data)

POST /api/v1/media
Authorization: Bearer {token}
Content-Type: multipart/form-data

attachable_type=gym
attachable_id=42
file=@photo.jpg

Response

201 Created

Returns the created media resource.

Example

{
  "media": { /* media resource */ }
}

For a full schema, see Media Resource.


Error Responses

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

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

LinkedinInstagramXYoutube