Upload an Attachment
To add an attachment to an application you need the application ID and the attachment itself to upload. You have to submit a request with the body being in multipart/form-data format. The file is represented by the field named ‘file‘ (see example below).
See these pages to learn how to remove the attachment again.
HTTP-Method
POST
Path
/api/rest/v3/frontend/attachments/
Authentification
Path Parameter
-none-
Query Parameter
applicationId
Responses
Action | Response | Description |
---|---|---|
success | see example call | File information about the uploaded attachment. Does not contain the file itself. |
authorization error | 401 / 403 | See here and here for details. |
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=@attachment.pdf" "https://api.softgarden.io/api/rest/v3/frontend/attachments/?applicationId=1b639d3b-57b3-4b31-9fac-83a8c5d9443a" |
Antwort:
1 2 3 4 5 6 7 |
{ "id" : "417990c1-2238-44dc-9b04-3fb697753821", "name" : "attachment.pdf", "type" : "application/pdf", "fileSize" : 294011, "content" : null } |