live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
exam optional , nil allowed . Must be a Hash
exam[name] required . Must be String

The name.

exam[begin_at] required . Must be Fixnum

The begin at. .

exam[end_at] required . Must be Fixnum

The end at. . Beginning must be after ending.

exam[location] required . Must be String

The location.

exam[ip_range] required . 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] required . 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.

POST /v2/exams
{
  "exam": {
    "begin_at": "2015-07-17T15:00:00.000Z",
    "campus_id": 1,
    "end_at": "2015-07-17T19:00:00.000Z",
    "ip_range": "10.11.0.0/16,10.12.0.0/16,10.13.0.0/16,10.42.0.0/16",
    "location": "e1,e2,e3",
    "max_people": 780,
    "name": "Piscine C - Exam 01",
    "project_ids": [
      405
    ],
    "visible": "true",
    "activate_waitlist": "false"
  }
}
201
{
  "id": 42,
  "ip_range": "10.11.0.0/16,10.12.0.0/16,10.13.0.0/16,10.42.0.0/16",
  "begin_at": "2015-07-17T15:00:00.000Z",
  "end_at": "2015-07-17T19:00:00.000Z",
  "location": "e1,e2,e3",
  "max_people": 780,
  "nbr_subscribers": 594,
  "name": "Piscine C - Exam 01",
  "created_at": "2015-07-15T13:05:26.006Z",
  "updated_at": "2018-08-27T16:56:15.032Z",
  "campus": {
    "id": 1,
    "name": "Paris",
    "time_zone": "Europe/Paris",
    "language": {
      "id": 1,
      "name": "Français",
      "identifier": "fr",
      "created_at": "2014-11-02T16:43:38.466Z",
      "updated_at": "2021-10-08T16:28:44.040Z"
    },
    "users_count": 22319,
    "vogsphere_id": 1,
    "country": "France",
    "address": "96, boulevard Bessières",
    "zip": "75017",
    "city": "Paris",
    "website": "http://www.42.fr/",
    "facebook": "https://facebook.com/42born2code",
    "twitter": "https://twitter.com/42born2code",
    "active": true,
    "email_extension": "42.fr",
    "default_hidden_phone": false
  },
  "cursus": [
    {
      "id": 4,
      "created_at": "2015-05-01T17:46:08.433Z",
      "name": "Piscine C",
      "slug": "piscine-c"
    },
    {
      "id": 6,
      "created_at": "2015-09-21T12:36:09.128Z",
      "name": "Piscine C décloisonnée",
      "slug": "piscine-c-decloisonnee"
    },
    {
      "id": 13,
      "created_at": "2017-02-01T14:25:42.300Z",
      "name": "42 Labs",
      "slug": "42-labs"
    }
  ],
  "projects": [
    {
      "id": 405,
      "name": "Exam01",
      "slug": "piscine-c-exam01",
      "parent": null,
      "children": [],
      "attachments": [],
      "created_at": "2015-06-29T13:14:31.702Z",
      "updated_at": "2021-09-01T08:35:01.074Z",
      "exam": true,
      "git_id": null,
      "repository": null
    }
  ]
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"exam":{"begin_at":"2015-07-17T15:00:00.000Z","campus_id":1,"end_at":"2015-07-17T19:00:00.000Z","ip_range":"10.11.0.0/16,10.12.0.0/16,10.13.0.0/16,10.42.0.0/16","location":"e1,e2,e3","max_people":780,"name":"Piscine C - Exam 01","project_ids":[405],"visible":"true","activate_waitlist":"false"}}' "https://api.intra.42.fr/v2/exams"

{
  "id": 42,
  "ip_range": "10.11.0.0/16,10.12.0.0/16,10.13.0.0/16,10.42.0.0/16",
  "begin_at": "2015-07-17T15:00:00.000Z",
  "end_at": "2015-07-17T19:00:00.000Z",
  "location": "e1,e2,e3",
  "max_people": 780,
  "nbr_subscribers": 594,
  "name": "Piscine C - Exam 01",
  "created_at": "2015-07-15T13:05:26.006Z",
  "updated_at": "2018-08-27T16:56:15.032Z",
  "campus": {
    "id": 1,
    "name": "Paris",
    "time_zone": "Europe/Paris",
    "language": {
      "id": 1,
      "name": "Français",
      "identifier": "fr",
      "created_at": "2014-11-02T16:43:38.466Z",
      "updated_at": "2021-10-08T16:28:44.040Z"
    },
    "users_count": 22319,
    "vogsphere_id": 1,
    "country": "France",
    "address": "96, boulevard Bessières",
    "zip": "75017",
    "city": "Paris",
    "website": "http://www.42.fr/",
    "facebook": "https://facebook.com/42born2code",
    "twitter": "https://twitter.com/42born2code",
    "active": true,
    "email_extension": "42.fr",
    "default_hidden_phone": false
  },
  "cursus": [
    {
      "id": 4,
      "created_at": "2015-05-01T17:46:08.433Z",
      "name": "Piscine C",
      "slug": "piscine-c"
    },
    {
      "id": 6,
      "created_at": "2015-09-21T12:36:09.128Z",
      "name": "Piscine C décloisonnée",
      "slug": "piscine-c-decloisonnee"
    },
    {
      "id": 13,
      "created_at": "2017-02-01T14:25:42.300Z",
      "name": "42 Labs",
      "slug": "42-labs"
    }
  ],
  "projects": [
    {
      "id": 405,
      "name": "Exam01",
      "slug": "piscine-c-exam01",
      "parent": null,
      "children": [],
      "attachments": [],
      "created_at": "2015-06-29T13:14:31.702Z",
      "updated_at": "2021-09-01T08:35:01.074Z",
      "exam": true,
      "git_id": null,
      "repository": null
    }
  ]
}
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: "2015-07-17T15:00:00.000Z", campus_id: 1, end_at: "2015-07-17T19:00:00.000Z", ip_range: "10.11.0.0/16,10.12.0.0/16,10.13.0.0/16,10.42.0.0/16", location: "e1,e2,e3", max_people: 780, name: "Piscine C - Exam 01", project_ids: [405], visible: "true", activate_waitlist: "false"}}
response = token.post("/v2/exams", params: params)
response.status
# => 201
response.parsed
# => {"id"=>42, "ip_range"=>"10.11.0.0/16,10.12.0.0/16,10.13.0.0/16,10.42.0.0/16", "begin_at"=>"2015-07-17T15:00:00.000Z", "end_at"=>"2015-07-17T19:00:00.000Z", "location"=>"e1,e2,e3", "max_people"=>780, "nbr_subscribers"=>594, "name"=>"Piscine C - Exam 01", "created_at"=>"2015-07-15T13:05:26.006Z", "updated_at"=>"2018-08-27T16:56:15.032Z", "campus"=>{"id"=>1, "name"=>"Paris", "time_zone"=>"Europe/Paris", "language"=>{"id"=>1, "name"=>"Français", "identifier"=>"fr", "created_at"=>"2014-11-02T16:43:38.466Z", "updated_at"=>"2021-10-08T16:28:44.040Z"}, "users_count"=>22319, "vogsphere_id"=>1, "country"=>"France", "address"=>"96, boulevard Bessières", "zip"=>"75017", "city"=>"Paris", "website"=>"http://www.42.fr/", "facebook"=>"https://facebook.com/42born2code", "twitter"=>"https://twitter.com/42born2code", "active"=>true, "email_extension"=>"42.fr", "default_hidden_phone"=>false}, "cursus"=>[{"id"=>4, "created_at"=>"2015-05-01T17:46:08.433Z", "name"=>"Piscine C", "slug"=>"piscine-c"}, {"id"=>6, "created_at"=>"2015-09-21T12:36:09.128Z", "name"=>"Piscine C décloisonnée", "slug"=>"piscine-c-decloisonnee"}, {"id"=>13, "created_at"=>"2017-02-01T14:25:42.300Z", "name"=>"42 Labs", "slug"=>"42-labs"}], "projects"=>[{"id"=>405, "name"=>"Exam01", "slug"=>"piscine-c-exam01", "parent"=>nil, "children"=>[], "attachments"=>[], "created_at"=>"2015-06-29T13:14:31.702Z", "updated_at"=>"2021-09-01T08:35:01.074Z", "exam"=>true, "git_id"=>nil, "repository"=>nil}]}