Attach a media file to a specified element (e.g., gym, post, user).
You must have update permission for the target attachable resource.
Name | Type | Required | Description | Example |
---|---|---|---|---|
attachable_type | string | Yes | Type of the element to attach media to (see below) | "gym" |
attachable_id | int | Yes | ID of the element | 42 |
file | file | Yes | The media file to upload | (binary file) |
Available attachable_type
values:
championship
gym
gym_equipment
post
user
education
gym_buffet_item
training_service
tracker_meal
POST /api/v1/media
Authorization: Bearer {token}
Content-Type: multipart/form-data
attachable_type=gym
attachable_id=42
file=@photo.jpg
Returns the created media resource.
{
"media": { /* media resource */ }
}
For a full schema, see Media Resource.
Status | Description | Reference |
---|---|---|
422 | Validation error | Validation error |
401 | Unauthorized | Authentication error |
403 | Forbidden (no permission) | Permission error |