Uploading files using RESTful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2013 09:27 AM
I am using the following approach to perform uploading files to the Alfresco repository:
URL: http://localhost:8080/alfresco/service/api/upload/?alf_ticket = {User's ticket}parameters: [filedata, filename, description, siteid, containerId]
However, this approach does not allow me to insert files in specific subdirectories.
I need to perform file uploads via RESTful api using the uuid of the target folder.
Does anyone have any tips how to do this?
Alfresco Version: 4.2.c
ps. Sorry for my english!
Grateful.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2013 06:40 AM
I want to create a folder in PHP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2013 02:23 PM
So you can make your own API or just use the FormProcessor API as Share does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2013 10:26 AM
I've changed now to RESTful API.
I'd like to upload my files with REST API, but now I'm facing an other problem.
This is my URL:
http://localhost:8080/alfresco/service/api/upload
An this is my PHP code:
$json = (' { "filename":"HAHA.PDF", "destination":"workspace://SpacesStore/'.$parentID.'", "filedata":"'.$file.'" } '); $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, Array("Content-Type: application/json")); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC) ; curl_setopt($curl, CURLOPT_USERPWD, "admin:admin"); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, $submit_url); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $rs = curl_exec($curl);
Every time i execute my script, i receive an Error -> Error 500
best regards
pyt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2014 01:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2016 06:26 AM
I'm also still struggling to crack this issue, if you have already found how to do this in PHP, can you please mention that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 08:02 AM
siteid
, containerid
, uploaddirectory
to upload a file to a specific site directory inside documentLibrary
? It does not work… These are the values I use:siteid = "repo",containerid = "documentLibrary",uploaddirectory = "raps"
The files upload succesfully but it ignores the
uploaddirectory
param so I find them under repo/documentLibrary
instead of repo/documentLibrary/raps
.Is it my fault? I don't use
destination
param.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 11:01 AM
<ol>
<li>"dir" won't work</li>
<li>"/dir" won't work</li>
<li>"dir/" won't work</li>
<li>"/dir/" works!</li>
</ol>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2015 08:21 AM
i am new to this tool.I am using restful api for uploading files.By using noderef i can upload files.Is it anyway upload files by folder name
In our application I have folder like Testing under testing, i have sub folder like test 1 ,test 2 etc.this test1 and test2 generated in alfresco whenever user register application by using alfresco rest api.By looking node ref and nodeid everytime is not good deal.Could you pleaee provide any feasible solution with sample code for uploading and downloading
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 05:37 AM
I'm try to upload a file to the shared folder…
This is my code.
<java>
// using httpclient-4.5
Path filePath = Paths.get("C:/afile.txt");
String ticket = getTicket(); // get a ticket via /alfresco/service/api/login…
CloseableHttpClient client = HttpClients.createDefault();
HttpPost post = new HttpPost("http://localhost:8080/alfresco/service/api/upload?alf_ticket=" + ticket);
MultipartEntityBuilder entity = MultipartEntityBuilder.create();
StringBody descriptionBody = new StringBody("a test", ContentType.TEXT_PLAIN);
StringBody siteId = new StringBody("company_home", ContentType.TEXT_PLAIN); // how can upload the file
StringBody containerid = new StringBody("/Shared", ContentType.TEXT_PLAIN); // in the shared folder??
entity.addBinaryBody("filedata", filePath.toFile());
entity.addPart("siteid", siteId);
entity.addPart("containerid", containerid);
post.setEntity(entity.build());
CloseableHttpResponse postResponse = client.execute(post);
// …
</java>
Can anyone help me? Thanks.