[rt-users] REST Interface and Authentication

Shawn M Moore sartak at bestpractical.com
Wed Jun 11 12:58:24 EDT 2008


On Wed, Jun 11, 2008 at 04:22:06PM +0200, Martin BOULADOUR wrote:
> Hi again,
> 
> > The REST interface accepts "user" and "pass" parameters. If you're using
> > Perl, the code will look something like:
> >
> >     $mech->post("$baseurl/REST/1.0/search/ticket", [
> >         user  => "root",
> >         pass  => "password",
> >         query => "queue='foo'",
> >     ]);
> 
> Is it true for all the REST interface?
> 
> When I send a HTTP GET request on a URL like:
> 
>   http://rt.example.com/REST/1.0/search/ticket?query=...&user=root&pass=password
> 
> it works, but when I try on another URL like:
> 
>   http://rt.example.com/REST/1.0/ticket/55?user=root&pass=password
> 
> I get a "401 Credentials required" response...

This may be something that was fixed in the upcoming 3.8. Here's what
happens when I do it, using the LWP::Simple module:

$ curl 'http://localhost/REST/1.0/search/ticket?query=id%3e1&user=root&pass=password'
RT/3.7.86 200 Ok

2: yoof
3: fooo

$ curl 'http://localhost/REST/1.0/ticket/1?user=root&pass=password'
RT/3.7.86 200 Ok

id: ticket/1
Queue: General
Owner: root
...

RT (though this may only be 3.8) does send a cookie if you send your
credentials this way, so you should be able to reuse that cookie from
the first request for the second request.

Shawn



More information about the rt-users mailing list