How to log in into Redmine using REST API

Randhir Singh picture Randhir Singh · Nov 4, 2014 · Viewed 17.3k times · Source

I have the requirement to log in into Redmine using the REST API. Is it possible to login in Redmine using REST API? How can I handle it?

Answer

Benjamin Diele picture Benjamin Diele · Nov 4, 2014

On the Redmine API wiki you can see the following:

Most of the time, the API requires authentication. To enable the API-style authentication, you have to check Enable REST API in Administration -> Settings -> Authentication.

Then, authentication can be done in 2 different ways:

  • using your regular login/password via HTTP Basic authentication.

  • using your API key which is a handy way to avoid putting a password in a script.

The API key may be attached to each request in one of the following way:

  • passed in as a "key" parameter

  • passed in as a username with a random password via HTTP Basic authentication

  • passed in as a "X-Redmine-API-Key" HTTP header (added in Redmine 1.1.0)

You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout.

If you want to use HTTP Basic Authentication you could use this:

1.HTTP Basic auth – http://login:[email protected]/issues.xml
2.HTTP Basic auth with API token and login – http://login:[email protected]/issues.xml- (not supported yet)
3.HTTP Basic auth with API token – http://RANDOM_KEY:[email protected]/issues.xml
4.Full token auth – http://redmine.org/issues.xml?key=RANDOM_KEY