Add an image
const url = 'http://localhost:8080/api/v1/activities/activity-9756441741/images';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/activities/activity-9756441741/images \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@fileStores the image and appends it to the activity’s images.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The prefixed activity identifier, activity- included.
Request Bodyrequired
Section titled “Request Bodyrequired”object
A jpg, png or webp image.
Responses
Section titled “Responses”The image was added to the activity.
object
Where the image is served. With demo mode enabled, visitors who are not logged in get a placeholder photo instead.
Example
{ "id": "activityImage-0a8cdfbb-63b4-4f0f-a09d-faedd5a00753", "url": "https://dreeve.example.com/files/activities/0a8cdfbb-63b4-4f0f-a09d-faedd5a00753.jpg"}No usable file part was sent.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "missing_file", "message": "A \"file\" part is required."}The Authorization header was missing, malformed, or did not match the configured key.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "invalid_token", "message": "A valid API token is required. Send it in the Authorization header as a Bearer token."}Headers
Section titled “Headers”No activity with this identifier exists.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "not_found", "message": "Activity \"activity-1\" not found"}This instance runs with IMPORT_MODE=stravaApi
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "import_mode_not_files", "message": "Images can only be added to activities when running in file import mode."}The file is larger than upload_max_filesize, or the whole request is larger than post_max_size.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "file_too_large", "message": "The uploaded file is too large."}The body was not multipart/form-data.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "unsupported_media_type", "message": "Send the file as multipart/form-data."}The file is not a jpg, png or webp image.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "unsupported_file_type", "message": "The file is not a jpg, png or webp image."}The upload could not be stored.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "internal_error", "message": "The upload could not be stored."}