REST API group file upload

70 visualizzazioni
Passa al primo messaggio da leggere

Thilo Boehm

da leggere,
11 ago 2014, 16:49:5711/08/14
a open...@googlegroups.com
Hi all,

I am trying to upload files to a group folder via the REST API.
In the documentation (9.4.1) I found:

/groups/{groupKey}/folder

POST

acceptable request representations:

  • application/x-www-form-urlencoded
But if I try this URL I always get a 403/Forbidden response.
In the sourcecode I don't find any hint to this REST-Call.

Any hints?

Kind regards
Thilo

Florian Gnägi

da leggere,
14 ago 2014, 14:15:2614/08/14
a open...@googlegroups.com
Hi Thilo

Just tested, works as expected. 


- make sure after folder is no slash: 
  e.g. .../restapi/groups/45547525/folder and not …/restapi/groups/45547525/folder/
- does the user have access rights to this group?
- is the folder tool enabled for this group?
- did you use the authentication mechanism? You can use restapi/auth/username?password=1234 to generate an X-OLAT-TOKEN for the following requests or add the authentication to every request using the standard http authentication mechanism.

Cheers
Florian


--
--
Sie erhalten diese Nachricht, weil Sie Mitglied sind von Google
Groups-Gruppe "OpenOLAT".
Für das Erstellen von Beiträgen in dieser Gruppe senden Sie eine E-Mail
an open...@googlegroups.com
Um sich von dieser Gruppe abzumelden, senden Sie eine E-Mail an
openolat+u...@googlegroups.com
Weitere Optionen finden Sie in dieser Gruppe unter
http://groups.google.com/group/openolat?hl=de
-------------------------------------------------------------------------------------------------------------------
OpenOLAT - infinite learning - http://www.openolat.org

---
You received this message because you are subscribed to the Google Groups "OpenOLAT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openolat+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--------------------------------------------------------------------
professional services for the e-learning system OpenOLAT and OLATpro
 hosting - operating - support - development - mobile - consulting
--------------------------------------------------------------------

frentix  GmbH
Florian Gnägi, Geschäftsführer
Hardturmstrasse 76
CH-8005 Zürich, Switzerland

skype:gnaegi  twitter:gnaegi  xing:Florian_Gnaegi 
--------------------------------------------------------------------















Thilo Boehm

da leggere,
15 ago 2014, 09:20:1715/08/14
a open...@googlegroups.com
Hi Florian,

yes to all of your questions.
It looks like it has something to do with the Content-Type mulipart/form-data.
If I just add a file (a jpg for example) OpenOLAT can not resolve the filename at Line 277 in VFSWebservice.java:

String filename = partsReader.getValue("filename");

It works if a add another part to the request with the name "filename" and the filename as content.

That's a bit strange, as the filename is already available in the Content-Type Header:

------=_Part_1_13739372.1408108612819
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="filename"

test2.jpg
------=_Part_1_13739372.1408108612819
Content-Type: image/jpeg; name=cloudzone1.jpg
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="cloudzone1.jpg"; filename="cloudzone1.jpg"

Regards
Thilo


--------------------------------------------------------------------
<div style="word-wrap: break-word; -webkit-nbsp-mod
...
Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi