Note | ||
---|---|---|
| ||
Remember, you can get allowed methods, description, parameters, etc. by making a OPTIONS HTTP request to /v2/request/change. Code Block | | |
|
Code Block |
---|
curl -X POST https://vss-api.eis.utoronto.ca/v2auth/request/change" -token -u <username> |
For example, extracting the token with the jq command:
Code Block |
---|
TK=$(curl -X OPTIONSPOST "https://vss-api.eis.utoronto.ca/v2/request/change"auth/request-token -u <username> | jq '.token') |
List
To list a summary of your change requests, do a GET request to /request resource as follows:
Code Block |
---|
http GET https://vss-api.eis.utoronto.ca/v2/request/change "Authorization: Bearer $TK" |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "data": [ "https://vss-api.eis.utoronto.ca/v2/request/change/17", "https://vss-api.eis.utoronto.ca/v2/request/change/22", "https://vss-api.eis.utoronto.ca/v2/request/change/20", "https://vss-api.eis.utoronto.ca/v2/request/change/21", "https://vss-api.eis.utoronto.ca/v2/request/change/23", "https://vss-api.eis.utoronto.ca/v2/request/change/221", "https://vss-api.eis.utoronto.ca/v2/request/change/222", "https://vss-api.eis.utoronto.ca/v2/request/change/31", "https://vss-api.eis.utoronto.ca/v2/request/change/32", "https://vss-api.eis.utoronto.ca/v2/request/change/33" ], "meta": { "_link": { "self": "https://vss-api.eis.utoronto.ca/v2/request/change" }, "count": 10, "pages": { "first_url": "https://vss-api.eis.utoronto.ca/v2/request/change?per_page=10&page=1", "last_url": "https://vss-api.eis.utoronto.ca/v2/request/change?per_page=10&page=11", "next_url": "https://vss-api.eis.utoronto.ca/v2/request/change?per_page=10&page=2", "page": 1, "pages": 11, "per_page": 10, "prev_url": null, "total": 109 }, "time": "0.02024s", "user": "josem" } } |
Update
Currently, only two attributes can be updated of a given change request: scheduled and scheduled_datetime. Both attributes allow you to schedule a change on a given date and time (How to schedule VM changes) and updating listed attributes allow you to either cancel or re-schedule a given change without deleting it or resubmitting your request.
To cancel an CANCEL an already scheduled SCHEDULED change:
Code Block |
---|
http PUT https://vss-api.eis.utoronto.ca/v2/request/change/<change_id> "Authorization: Bearer $TK" scheduled:=false
curl -H "Content-Type: application/json" -H "Authorization: Bearer $TK" -X PUT https://vss-api.eis.utoronto.ca/v2/request/change/<change_id> -d '{"scheduled": false}' |
To reschedule a scheduled change:
Code Block |
---|
http -a $TK PUT https://vss-api.eis.utoronto.ca/v2/request/change/<change_id> "Authorization: Bearer $TK" schaeduled_datetime="2016-10-20 21:50" scheduled:=true curl -H "Content-Type: application/json" -H "Authorization: Bearer $TK" -X PUT https://vss-api.eis.utoronto.ca/v2/request/change/<change_id> -d '{"scheduled_datetime": "2016-10-20 21:50", "scheduled": true}' |
Both requests will result in an empty response body with a 204 status as follows:
Code Block |
---|
HTTP/1.0 204 NO CONTENT Allow: PUT, HEAD, OPTIONS, GET Connection: keep-alive Content-Length: 1097 Content-Type: application/json Date: Thu, 20 Oct 2016 16:00:44 GMT Server: nginx Strict-Transport-Security: max-age=63072000 X-Content-Type-Options: nosniff X-Frame-Options: DENY X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4998 X-RateLimit-Reset: 1476982800 |
Executed a failed request
To re-execute a request with status ERROR, use the PATCH method:
Code Block |
---|
http PATCH https://vss-api.eis.utoronto.ca/v2/request/change/<change_id> "Authorization: Bearer $TK"
curl -H "Content-Type: application/json" -H "Authorization: Bearer $TK" -X PATCH https://vss-api.eis.utoronto.ca/v2/request/change/<change_id> |
Previous request, will result in a response with the new task_id:
Code Block |
---|
{
"data": {
"_links": {
"request": "https://vss-api.eis.utoronto.ca/v2/request/change/3",
"task": "https://vss-api.eis.utoronto.ca/v2/request/task/0f39fa9f-4f35-426a-8ebb-8f1b34588fef"
},
"message": "VM Change Request has been accepted for processing",
"name": "Accepted",
"state": "Submitted",
"status": 202
},
"meta": {
"time": "0.03691s",
"user": "jm"
}
} |