== Climate4Impact == The Downscaling Portal RESTful API is token based authentication. That means, the user has to include a token in every request. == Access the API == Climate4Impact has an existing account into the Downscaling Portal. With the credentials provided is very simple to authenticate and get the token. {{{ curl -i -X POST -d username=your_username -d password=your_password http://meteo.unican.es/dp/rest/authenticate }}} Success {{{ HTTP/1.1 201 Created Date: Mon, 24 Mar 2014 08:59:04 GMT token: your_token Content-Length: 0 Content-Type: text/plain }}} == User Administration == The API allows the manager to create users who have the same experiments as him and this users will be attached to the manager. Thus, users can be added, listed and removed from the DPRA Climate4Impact service. In order to clarify how to use the API quickly, we are going to follow an example step by step. === 1. Create a new user === {{{ curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "token: your_token" -X POST -d "{\"username\": \"pcmdi9.llnl.gov.openid.vegasm\", \"email\": \"vegasm@unican.es\", \"openID\": \"https://pcmdi9.llnl.gov/openid/vegasm\"}" http://meteo.unican.es/dp/rest/users }}} Response {{{ HTTP/1.1 201 Created Date: Mon, 24 Mar 2014 09:08:17 GMT Content-Length: 0 Content-Type: text/plain }}} If the request generates an exception or something is missing, an error will be shown. Note: In some cases, it is possible that the character " has not to be escaped. === 2. List users === {{{ curl -i -H "token: your_token" http://meteo.unican.es/dp/rest/users }}} Success {{{ HTTP/1.1 200 OK Date: Mon, 24 Mar 2014 08:59:48 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked {"responseCode":"success","message":"List of users retrieved","values":[{"username":"pcmdi9.llnl.gov.openid.vegasm","password":null,"email":"vegasm@unican.es","openID":"pcmdi9.llnl.gov.openid.vegasm"}]} }}} === 3.Remove user === {{{ curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "token: your_token" -X DELETE http://meteo.unican.es/dp/rest/users/pcmdi9.llnl.gov.openid.vegasm }}} Success {{{ HTTP/1.1 200 OK Date: Mon, 24 Mar 2014 09:00:59 GMT Content-Length: 0 Content-Type: text/plain }}}