Upload file with properties (multiple value)

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

Upload file with properties (multiple value)

I'm trying to upload a file to my alfresco repository (using the rest api) along with some custom properties.

I'm having no trouble with the file or properties that only have only one value, but when I try and input values for the properties with multiple values, I keep getting errors.

attached is the code I am using to build the entity to send. all of the properties I am sending are d:long in the repository, but stringbody seems to work for the other values.

any advice on how I can set these multi-value properties? - preferably without having to make a second call to update

MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
multipartEntityBuilder.addPart("filedata", filedata);
for(NameValuePair pair : metadataList){
    ContentBody textContent = new StringBody(pair.getValue(), ContentType.TEXT_PLAIN);
    multipartEntityBuilder.addPart(pair.getName(), textContent);
}
return multipartEntityBuilder.build();
3 Replies
Highlighted
Alfresco Employee

Re: Upload file with properties (multiple value)

For reference, can you please confirm your Alfresco version ? 

If you're using 5.2+, which REST API / url:

* V0 => POST .../alfresco/s/api/upload

* V1 => POST .../alfresco/api/-default-/public/alfresco/versions/1/nodes/{parentid}/children

Thanks,

Jan

Highlighted
Member II

Re: Upload file with properties (multiple value)

I am using Alfresco version 5.2 and V1 of the rest api

Highlighted
Alfresco Employee

Re: Upload file with properties (multiple value)

Thanks.

This sounds like an enhancement request.

If you're using Enterprise 5.2+, then please contact Alfresco Customer Support.

If you're using Community 5.2+, then please feel free to raise an ALF jira. If you can provide a PR (pull-request) along with automated unit tests, then that would be a great contribution :-)

GitHub - Alfresco/alfresco-remote-api 

Either way, it would help if you can give a details of how you might expect this to work (with multi-part/form-data) including example requests etc.

Regards,

Jan