[Building Sakai] Request for help on accessing Sakai REST web services

Steve Swinsburg steve.swinsburg at gmail.com
Tue Jul 8 05:42:47 PDT 2014


Hi,

Do a POST to:
http://localhost:8081/direct/session.json?_username=admin&_password=admin

using the host,port and credentials that you need.

You get back a 201 response with the session id in the response body and
the Set-Cookie header in the response headers, eg:
Set-Cookie: JSESSIONID=e3969f8e-47e3-4aaf-b950-646c39f5526c.localhost;
Path=/; HttpOnly

You can then use that in your cookie directly and on the next request you
will be logged in, or use the sessionid on subsequent requests.

There is another param you can tack onto requests to ensure the session is
still valid when making the request, _validateSession.
https://jira.sakaiproject.org/browse/SAK-25843

Note that if you fire that request again, you may get an error. This is a
long standing issue that was resolved but may still be a problem:
https://jira.sakaiproject.org/browse/SAK-20624

cheers,
Steve





On Tue, Jul 8, 2014 at 12:15 AM, Laxman Deepak <
laxmandeepak.vidyayug at gmail.com> wrote:

> Hi,
>
> I am creating a session,Passing the username and password as parameters to
> the URL but i am not able to login.By accessing the web service from the
> following URL,i am able to get the session but  it is not validating the
> provided username and password,Because when i am accessing  list of tools
> from a particular site 403 forbidden error is displayed.
>
>
> http://localhost:2016/direct/session?_username='admin'&_password='admin'
>
> Please suggest me,is this the right way to pass the parameters in the URL
> for the Sakai REST web services.
>
>
>
>
> On Tue, Jul 1, 2014 at 4:32 AM, Steve Swinsburg <steve.swinsburg at gmail.com
> > wrote:
>
>> Have a look at /direct/session/describe
>>
>> Cheers
>> Steve
>>
>> sent from my mobile device
>> On 01/07/2014 12:47 AM, "Laxman Deepak" <laxmandeepak.vidyayug at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I am able to create a new session by using session
>>> provider(EntitySession) as given in following URL
>>>
>>>              http://localhost:2016/direct/session
>>>
>>> Can you please suggest me how to log in to the newly created session by
>>> giving username and password as parameters in the URL(REST WebServices).
>>>
>>>
>>> On Sun, Jun 29, 2014 at 5:28 PM, Steve Swinsburg <
>>> steve.swinsburg at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Have a look at the session provider, you can login to that one first
>>>> then you'll have a cookie to get at the rest of the requests.
>>>>
>>>> cheers,
>>>> Steve
>>>>
>>>>
>>>>
>>>> On Sat, Jun 28, 2014 at 2:04 AM, Laxman Deepak <
>>>> laxmandeepak.vidyayug at gmail.com> wrote:
>>>>
>>>>> Hi Team,
>>>>>
>>>>>     I am accessing the sakai REST web services in my local system.I am
>>>>> trying to invoke pages in a particular site by giving the siteId in the
>>>>> requested web service URL as follows.
>>>>>
>>>>>
>>>>> http://localhost:2016/direct/site/a0e479f4-3cfa-46d4-ab97-b75aa88fd7dc/pages.json
>>>>>
>>>>> But i am unable to access the above mentioned URL without any one of
>>>>> that particular site user logged into the browser.
>>>>>
>>>>> Note:once i login with one of the site user in another tab,i can
>>>>> access above mentioned URL and it is returning the JSON data successfully.
>>>>>
>>>>> How can i get JSON data without user logged into the browser or is
>>>>> there anyway pass the username and password as parameters to the URL and
>>>>> can we create a session?.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thanks & Regards
>>>>> Kona Laxman Deepak
>>>>>
>>>>> _______________________________________________
>>>>> 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"
>>>>>
>>>>
>>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140708/d88e8a69/attachment.html 


More information about the sakai-dev mailing list