Changed REST Interface in RT 4(.4)?

The wikipage about the REST-Interface says, that for /REST/1.0/ the response should be:

RT/3.4.5 200 Ok

# Invalid object specification: 'index.html'

id: index.html

But in my 4.4.2 installation I get this:

RT/4.4.2 401 Credentials required

And when doing the login at this page, I get redirected afterwards to /SelfService/, not the response it has been been before like:

RT/4.4.2 200 Ok

Is there documentation about the changes in the interface?

1 Like

I seems that HTML is always returned. I can also reproduce this with the examples from the wiki: https://rt-wiki.bestpractical.com/wiki/REST

On our 4.4.2 installation, going to /REST/1.0 gives:

RT/4.4.2 200 Ok

# Invalid object specification: ''

id: 

If I go to /REST/1.0/index.html I get the expected:

RT/4.4.2 200 Ok

# Invalid object specification: 'index.html'

id: index.html

Are you logged in when you do your call? When I call the API to get (for example) a ticket, the content-type of the response is text/plain.

Hi and thanks for your response.

I get the same behavior for both being logged in in a browser and logged out. But I didn’t use this browser for the tests.

I use this for the login as documented here: https://rt-wiki.bestpractical.com/wiki/REST#Authentication
> wget --keep-session-cookies --save-cookies cookies.txt --post-data 'user=[user]&pass=[pw]' http://localhost:8085/REST/1.0/

And I get back the index.html, which is not the login form, but the page for already being logged in and it lists the tickets!

With a basic get request like
> wget --keep-session-cookies --save-cookies cookies.txt http://localhost:8085/REST/1.0/ticket/1/show
I get again the index page like above (as I am logged in), not the ticket itself

If I am not authenticated i.e. I don’t have cookies, I get the expected response:
> wget http://localhost:8085/REST/1.0/ticket/1/show gives
RT/4.4.2 401 Credentials required

How do you authenticate with the API?

I’ve just used the wget commands and its produced the expected output on our 4.4.2 instance of RT. Authenticated using “user” and “pass” as you have.

Is it needed to activate REST for a user or so?

I found this testing instance: http://demo.request-tracker.fr/
That works for all users except the client one.

On my 4.4.2 instance, everything works for my privileged users. An unprivileged user gets only HTML returned.