[Building Sakai] Uploading files to Resources via RESTful API?

John Bush jbush at anisakai.com
Fri May 9 22:17:26 PDT 2014


If you are looking to upload file content this can be done with the
new stuff in soap or rest.  This stuff is very easy to backport to
2.9.x, for an example of that see our branch here:
https://source.sakaiproject.org/svn/msub/rsmart.com/webservices/branches/2.9.4.x/

What is in trunk is here:

https://source.sakaiproject.org/svn/webservices/trunk/cxf/src/java/org/sakaiproject/webservices/ContentHosting.java

the method signature for adding new content items with all the
annotations follows:

@WebMethod
    @Path("/createContentItem")
    @Produces("text/plain")
    @GET
    public String createContentItem(
            @WebParam(name = "sessionid", partName = "sessionid")
@QueryParam("sessionid") String sessionid,
            @WebParam(name = "name", partName = "name")
@QueryParam("name") String name,
            @WebParam(name = "collectionId", partName =
"collectionId") @QueryParam("collectionId") String collectionId,
            @WebParam(name = "contentMime", partName = "contentMime")
@QueryParam("contentMime") String contentMime,
            @WebParam(name = "description", partName = "description")
@QueryParam("description") String description,
            @WebParam(name = "type", partName = "type")
@QueryParam("type") String type,
            @WebParam(name = "binary", partName = "binary")
@QueryParam("binary") boolean binary)

On Thu, May 8, 2014 at 6:37 AM, Sam Ottenhoff <ottenhoff at longsight.com> wrote:
> One note: John Bush from ANI led a rewrite of the Axis-based webservices for
> Sakai 10.  This work is in webservices/cxf.  One of the main complaints we
> heard about Axis webservices were odd issues with the JWS compilation
> especially if the webservices were accessed during node startup.  Here is an
> example of a method signature in SakaiScript.java in the new CXF-based
> webservices. This method would be accessible via REST or SOAP.
>
>     @WebMethod
>     @Path("/addNewUser")
>     @Produces("text/plain")
>     @GET
>     public String addNewUser(
>             @WebParam(name = "sessionid", partName = "sessionid")
> @QueryParam("sessionid") String sessionid,
>             @WebParam(name = "eid", partName = "eid") @QueryParam("eid")
> String eid,
>             @WebParam(name = "firstname", partName = "firstname")
> @QueryParam("firstname") String firstname,
>             @WebParam(name = "lastname", partName = "lastname")
> @QueryParam("lastname") String lastname,
>             @WebParam(name = "email", partName = "email")
> @QueryParam("email") String email,
>             @WebParam(name = "type", partName = "type") @QueryParam("type")
> String type,
>             @WebParam(name = "password", partName = "password")
> @QueryParam("password") String password) {
>
>
>
>
>
> On Wed, May 7, 2014 at 7:52 PM, Lydia Li <lydial at stanford.edu> wrote:
>>
>> Thanks Taper.
>>
>> I found that I could just use Sakai's WebServlet to upload a file to the
>> Content Resources so that's what I will be using.  BTW, for the project I'm
>> working on I need to use REST.
>>
>> For your question, maybe you can start by looking at the
>> entitybroker/rest/src/java/org/sakaiproject/entitybroker/rest/EntityHandlerImpl.java.
>>
>>
>> thanks,
>> Lydia
>>
>>
>>
>> ________________________________
>>
>> From: "cn19998" <cn19998 at qq.com>
>> To: "sakai_dev" <sakai-dev at collab.sakaiproject.org>
>> Sent: Wednesday, May 7, 2014 8:49:20 AM
>>
>> Subject: Re: [Building Sakai] Uploading files to Resources via RESTful
>> API?
>>
>> Hi Lydia,
>>
>>    I found that SOAP services provided in Sakai can be used to upload
>> contents. Maybe you can try:
>> http://localhost:8080/sakai-axis/ContentHosting.jws?wsdl.
>>
>>   By the way. I found it hard to use the RESTful Services in Sakai without
>> documentation. Maybe viewing the
>> source code could help me understand it more. However, I tried to search
>> for "@Path" or "@GET"(something
>> typical in REST services" in Sakai source distribution but resulted in
>> vain. Can someone tell me where those classes
>> providing REST services are located? (There should be some, I think.)
>>
>> Thanks,
>> Taper.
>>
>> source code
>> On 2014/4/15 9:42, Lydia Li wrote:
>>
>> Hi Steve,
>>
>>     It would be great if you could put your PDF on the mobile confluence
>> page.   Yes I've been looking at the /direct/describe.
>>     Back to my first question, are you aware of anyone working on
>> developing the REST web services for uploading a file to the Resources Tool?
>> Is that in the plan for Keitai?
>>
>> thanks,
>> Lydia
>>
>>
>>
>>
>> ________________________________
>>
>> From: "Steve Swinsburg" <steve.swinsburg at gmail.com>
>> To: "Aaron Zeckoski" <azeckoski at unicon.net>
>> Cc: "sakai-dev" <sakai-dev at collab.sakaiproject.org>, "Li Lydia"
>> <lydial at stanford.edu>
>> Sent: Monday, April 14, 2014 6:34:00 PM
>> Subject: Re: [Building Sakai] Uploading files to Resources via RESTful
>> API?
>>
>> Best doco is at /direct/describe. I have a PDF that summarises the work
>> done in Keitai if you'd like a copy. Could put it on the mobile confluence
>> page.
>>
>> sent from my mobile device
>>
>> On 15/04/2014 8:47 AM, "Aaron Zeckoski" <azeckoski at unicon.net> wrote:
>>>
>>> It's meant to be self documenting (or at least, that was my intent).
>>> http://nightly2.sakaiproject.org:8082/direct/describe
>>>
>>> -AZ
>>>
>>>
>>> On Mon, Apr 14, 2014 at 6:40 PM, Lydia Li <lydial at stanford.edu> wrote:
>>> > Hi all,
>>> >
>>> >     Has anyone worked on uploading contents to the Resources tool via
>>> > RESTful API in Sakai?   As far as I can tell from reading what's listed
>>> > under /direct/describe, there are no existing APIs yet.
>>> >     Also, are there any other documentations for Sakai's RESTful web
>>> > services besides what's here:
>>> > https://confluence.sakaiproject.org/display/MOBILE/Home?   I can't seem
>>> > to
>>> > find a lot of documentations on this topic.   I guess I can also go
>>> > read the
>>> > code.
>>> >
>>> > thanks,
>>> > Lydia
>>> >
>>> > _______________________________________________
>>> > sakai-dev mailing list
>>> > sakai-dev at collab.sakaiproject.org
>>> > http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>> >
>>> > TO UNSUBSCRIBE: send email to
>>> > sakai-dev-unsubscribe at collab.sakaiproject.org
>>> > with a subject of "unsubscribe"
>>>
>>>
>>>
>>> --
>>> Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
>>> _______________________________________________
>>> sakai-dev mailing list
>>> sakai-dev at collab.sakaiproject.org
>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>
>>> TO UNSUBSCRIBE: send email to
>>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>>> "unsubscribe"
>>
>>
>>
>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>>
>>
>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>>
>>
>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"



-- 
John Bush
602-490-0470

** This message is neither private nor confidential in fact the US
government is storing it in a warehouse located in Utah for future
data mining use cases should they arise. **


More information about the sakai-dev mailing list