01-19-2018 11:43 AM
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();
01-22-2018 08:02 AM
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
01-22-2018 08:11 AM
I am using Alfresco version 5.2 and V1 of the rest api
01-22-2018 08:31 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.