Add Aspects, Aspect Value along with Upload File using REST

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2015 09:33 PM
Hi,
i want to add 'aspects' and 'aspects value' along with 'upload file' in 1 REST request
file is uploaded, aspects is added but how can i add value to aspect? (PolicyNumber, ReferenceNumber)
Sorry for my english
i want to add 'aspects' and 'aspects value' along with 'upload file' in 1 REST request
public String uploadDocument(File fileobj, List<PropertiesModel> metaData) throws Exception { String ticketURLResponse = getTicket(); String urlString = "http://" + inboundServerIp + ":" + inboundServerPort + "/alfresco/service/api/upload?alf_ticket=" + ticketURLResponse; HttpClient client = new HttpClient(); PostMethod mPost = new PostMethod(urlString); BufferedReader br = null; try { Part[] parts = { new FilePart("filedata", fileobj, "application/pdf", null), new StringPart("filename", fileobj.getName()), new StringPart("destination", "workspace://SpacesStore/" + folderUUID), new StringPart("aspects", "PolicyNumber:PolicyNumber,ReferenceNumber:ReferenceNumber") }; mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost .getParams())); int statusCode1 = client.executeMethod(mPost); if (statusCode1 != 200) { throw new Exception("Error!" + mPost.getResponseBodyAsString()); } else { br = new BufferedReader(new InputStreamReader( mPost.getResponseBodyAsStream())); String readLine; while (((readLine = br.readLine()) != null)) { if (readLine.contains("workspace://SpacesStore/")) { break; } } int startindex = readLine.indexOf("workspace://SpacesStore/") + "workspace://SpacesStore/".length(); int endindex = readLine.indexOf("workspace://SpacesStore/") + "workspace://SpacesStore/".length() + 36; String uuid = readLine.substring(startindex, endindex); return uuid; } } catch (Exception e) { throw e; } finally { if (br != null) { br.close(); } mPost.releaseConnection(); } }
file is uploaded, aspects is added but how can i add value to aspect? (PolicyNumber, ReferenceNumber)
Sorry for my english
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2017 12:53 PM
how can you solve this issue?
