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:
championshipgymgym_equipmentpostusereducationgym_buffet_itemtraining_servicetracker_mealPOST /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 |