Hi @EddieMay
Thanks for your valuable help. Yesterday I tried to do the same but I have this error.
Hi @viperboys,
I've just used Postman to upload two documents to my home directory in Alfresco.
Here is the generated PHP code from Postman:
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children?alf_ticket=TICKET_53451c24e8042867a93f0d129bbd3b1f5e2a5a55", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('filedata'=> new CURLFILE('/Users/emay/Documents/Alfresco - a developer led strategy.pptx')), CURLOPT_HTTPHEADER => array( "Authorization: Basic dGVzdDp0ZXN0" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
Attached you can see the files in Share.
Here's the code for uploading a jpg file:
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children?alf_ticket=TICKET_53451c24e8042867a93f0d129bbd3b1f5e2a5a55", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('filedata'=> new CURLFILE('/Users/emay/Downloads/eddie.may.jpg')), CURLOPT_HTTPHEADER => array( "Authorization: Basic dGVzdDp0ZXN0" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
Hopefully this should give you a start to resolving your problem.
Hi @EddieMay
I am very grateful for your help. I am a little confused, this is because I am new to this area.
That php code was generated by Postman? How can I use it with postman? I have always used a URL, the method and send a JSON. This is how it worked for me but what you send me I don't know how to put it in Postman.
I hope you can help me. Thank you very much and happy day.
Hi @viperboys,
Don't worry - we were all new to this at one time. Some of us (like me) still are!!
The code I shared was acutally generated by Postman. The app has a "generate code" option - you can select the language & et voila! There are several languages available, including javascript such as Node. On my Mac the code button is to the right, below the Send button (see attached)
I'm thinking you can perhaps incorporate the url call & data into yourGravityFlow plugin WebHook.
HTH,
Hi @viperboys ,
In Postman I'd recommend getting the call to work - this will prove the concept that you can post a file to Alfresco using the Alfresco API.
Then in Postman you could begin to override the body of your working method to use JSON to include the file, authentication, etc. If you click on the body section and select Raw, you have json as an option (see attached).
HTH
Hi @viperboys,
Great news & happy to help. Have a great weekend!
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.