PATCH /v2/exams/:id
Update an exam
PUT /v2/exams/:id
Update an exam
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
exam | optional , nil allowed . Must be a Hash |
exam[name] |
optional
. Must be String
The name. |
exam[begin_at] |
optional
. Must be Fixnum
The begin at. . |
exam[end_at] |
optional
. Must be Fixnum
The end at. . Beginning must be after ending. |
exam[location] |
optional
. Must be String
The location. |
exam[ip_range] |
optional
. Must be String
The ip range. Maximum length is 255. |
exam[visible] |
optional
, nil allowed
. Must be one of: true , false .
Is it visible ? Default to true. |
exam[max_people] |
optional
, nil allowed
. Must be Fixnum
The max people. |
exam[campus_id] |
optional
. Must be Fixnum
The campus id. |
exam[activate_waitlist] |
optional
, nil allowed
. Must be String
The activate waitlist. |
exam[project_ids] |
optional
, nil allowed
. Must be an array of Integer
The project ids. |
Examples
PUT /v2/exams/1
{
"exam": {
"begin_at": "2017-11-25 13:43:10 UTC",
"campus_ids": 4,
"end_at": "2017-11-29 13:43:10 UTC",
"ip_range": "10.20.0.0/16",
"location": "Cluj",
"max_people": 70,
"name": "Rainbowcat Exam 🌈",
"activate_waitlist": "true",
"project_ids": [
"3"
],
"visible": "true"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"exam":{"begin_at":"2017-11-25 13:43:10 UTC","campus_ids":4,"end_at":"2017-11-29 13:43:10 UTC","ip_range":"10.20.0.0/16","location":"Cluj","max_people":70,"name":"Rainbowcat Exam 🌈","activate_waitlist":"true","project_ids":["3"],"visible":"true"}}' "https://api.intra.42.fr/v2/exams/1"
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token
params = {exam: {begin_at: "2017-11-25 13:43:10 UTC", campus_ids: 4, end_at: "2017-11-29 13:43:10 UTC", ip_range: "10.20.0.0/16", location: "Cluj", max_people: 70, name: "Rainbowcat Exam 🌈", activate_waitlist: "true", project_ids: ["3"], visible: "true"}}
response = token.put("/v2/exams/1", params: params)
response.status
# => 204
response.parsed
# =>