Upload a Profile Picture
To add an profile picture to an application you’ll need the ID of the application (applicationId) and an image file to upload. Learn here how to remove the profile picture again. There can be only one profile picture in an application. If you want to replace the profile picture by another you have to remove the old one first and then upload the new one. To get the profile picture follow these steps.
HTTP-Method
POST
Path
/api/rest/v3/frontend/attachments/photo
Authentification
Path Parameter
-none-
Query Parameter
applicationId
Responses
Action | Response | Description |
---|---|---|
success | see example call | |
authorization error | 401 / 403 | See here and here for details. |
already present | 428 – { “code”: “precondition_failed_error”, “message”: “there is already a PHOTO for this application. you have to remove the old one first before uploading a new one.” } | The application already contains a profile picture. That one has to be removed first. |
error | 404 – { “code”: “get_application_error” } | No application was found for the provided ID. |
error | 400 – { “code”: “get_application_error”, “message”: “Cannot retrieve applications of others” } | The application does not belong to the user issued in the token |
error | 400 – { “code”: “application_deleted_error”, “message”: “Cannot retrieve deleted application” } | The application has been deleted |
error | 400 – { “code”: “application_access_error”, “message”: “Application is not editable anymore” } | The application is not editable anymore. |
Example call with curl and user access token
1 |
curl -i -H "Authorization: Bearer a88a95e3-c7ed-4619-abfe-de84165a6ba6" -X POST -F "file=@photo.jpg" "https://api.softgarden.io/api/rest/v3/frontend/attachments/photo?applicationId=1b639d3b-57b3-4b31-9fac-83a8c5d9443a" |
Response:
1 2 3 4 5 6 7 |
{ "id" : "98684fef-7a51-4167-a339-832ac3a0473b", "name" : "photo.jpg", "type" : "image/jpeg", "fileSize" : 12049, "content" : null } |