06-04-2024 05:00 AM
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:
Request Headers:
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"'
Explore our Alfresco products with the links below. Use labels to filter content by product module.