Skip to content

UploadAttachments - REST API changed, no hints in docs #7681

@desperateCoder

Description

@desperateCoder

Hi!
As a Maintainer of the Android Deck app i encounter some problems with uploading Attachments:
Starting from version 1.17.0 the endpoint expects the file data as a string (?!) while the docs state, that it should be uploaded as multipart/form-data.

Here's what i see in the logs:
"File":"/var/www/[redacted subfolder]/[redacted domain]/httpdocs/apps/deck/lib/Controller/AttachmentApiController.php","Line":49,"message":"Failed to call controller method: OCA\Deck\Controller\AttachmentApiController::create(): Argument #3 ($data) must be of type string, null given

Can someone please clarify how i am supposed to call the Endpoint from now on? 🤔

Here's my current implementation (still using v1.0, using v1.1 didn't change anything unfortunately):

final MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", attachment.getName(), RequestBody.create(MediaType.parse(getMimeType(attachment)), attachment));
final MultipartBody.Part typePart = MultipartBody.Part.createFormData("type", null, RequestBody.create(MediaType.parse(TEXT_PLAIN), type));

this.requestHelper.request(() -> provider.getDeckAPI().uploadAttachment(remoteBoardId, remoteStackId, remoteCardId, typePart, filePart), responseCallback);

As a Sidenote: The API doc is outdated and incomplete for years, I had to do a massive amount of reverse engineering and look up the code of this repo. Go ahead and try creating a Card via curl using only the information provided by the API docs, you will see what i mean... So a little bit love for the docs would be much appreciated! ❤️

EDIT:
By the way, the Response of the server in that case is a HTTP 400 with the body[] - that's it. Would be really great to actually know whats wrong. 🙈

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions