Changes between Version 2 and Version 3 of DownscalingPortal/RESTfulAPI/Climate4Impact
- Timestamp:
- Mar 24, 2014 10:41:50 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DownscalingPortal/RESTfulAPI/Climate4Impact
v2 v3 5 5 == Access the API == 6 6 7 Climate4Impact has an existing account into the Downscaling Portal. With the credentials provided is very simple to authenticate and get the token 7 Climate4Impact has an existing account into the Downscaling Portal. With the credentials provided is very simple to authenticate and get the token. 8 9 {{{ 10 curl -i -X POST -d username=your_username -d password=your_password http://meteo.unican.es/dp/rest/authenticate 11 }}} 12 13 Success 14 15 {{{ 16 HTTP/1.1 201 Created 17 Date: Mon, 24 Mar 2014 08:59:04 GMT 18 token: your_token 19 Content-Length: 0 20 Content-Type: text/plain 21 }}} 8 22 9 23 == User Administration == … … 15 29 === 1. Create a new user === 16 30 17 {{{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}}} 31 {{{ 32 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 33 }}} 18 34 19 35 Response 20 36 21 {{{HTTP/1.1 201 Created 37 {{{ 38 HTTP/1.1 201 Created 22 39 Date: Mon, 24 Mar 2014 09:08:17 GMT 23 40 Content-Length: 0 24 Content-Type: text/plain}}} 41 Content-Type: text/plain 42 }}} 25 43 44 If the request generates an exception or something is missing, an error will be shown. 45 Note: In some cases, it is possible that the character " has not to be escaped. 26 46 47 == List users == 48 49 {{{ 50 curl -i -H "token: your_token" http://meteo.unican.es/dp/rest/users 51 }}} 52 53 Success 54 55 {{{ 56 HTTP/1.1 200 OK 57 Date: Mon, 24 Mar 2014 08:59:48 GMT 58 Content-Type: application/json;charset=UTF-8 59 Transfer-Encoding: chunked 60 61 {"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"}]} 62 }}} 63 64 == Remove user == 65 66 {{{ 67 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 68 }}} 69 70 Success 71 {{{ 72 HTTP/1.1 200 OK 73 Date: Mon, 24 Mar 2014 09:00:59 GMT 74 Content-Length: 0 75 Content-Type: text/plain 76 }}}