Sending file using REST call task

cancel
Showing results for 
Search instead for 
Did you mean: 
darkul
Member II

Sending file using REST call task

Hi,

I need to use REST API endpoint (POST request) to send a file to ACS (Alfresco Content Services). How should i configure my REST call task to be able to do it? I do have a form in which I'm selecting file from my local. Then I would like to use it in my request. Config I've tried:

Endpoint: {{base-cms-url}}/-default-/public/alfresco/versions/1/nodes/-root-/children

Method: POST

Request mapping (JSON Template):

{
    "filedata": ${filetoupload},
    "nodeType": "cm:content",
    "autoRename": true
}

Response mapping:
image.png

Request Headers:

image.png

Also tried: multipart/form-data; boundary=---------------------------1234567890

Unfortunately I'm getting 400 HTTP error with no error message in my APS logs.

I'm using enterprise version of APS (24.x) and ACS (23.1.1).

I've also tried to use this endpoint with Postman and it works just fine (I'm using form-data there as Body):

curl --location --request POST '{{base-cms-url}}/-default-/public/alfresco/versions/1/nodes/-root-/children' \
--header 'Authorization: Basic SOMETOKENGENERATED \
--form 'filedata=@"/path/to/my/file.txt"' \
--form 'nodeType="cm:content"' \
--form 'autoRename="true"'