List all visibles exams. Invisibles exams need at least the basic_staff role.

live_help Notes

chrome_reader_mode This resource is paginated by 30 items
assignment_ind This action have additional content with a token resource owner or an application with one of theses role(s): Basic staff .

settings Params

Param name Description
cursus_id optional . Must be String

The cursus id or slug

campus_id optional . Must be String

The campus id or slug

user_id optional . Must be String

The user id or slug

project_id optional . Must be String

The project id or slug

sort optional . Must be one of: id, begin_at, end_at, location, ip_range, max_people, created_at, updated_at, visible, name, campus_id, validated_at, validator_id.

The sort field. Sorted by begin_at desc, id desc by default.

Example:

To sort on exams on the fields validated_at on a descending order and validator_id on a ascending order:

...&sort=-validated_at,validator_id

filter optional . Must be one of: id, begin_at, end_at, location, ip_range, max_people, created_at, updated_at, visible, name, campus_id, validated_at, validator_id, future, end, validated.

Filtering on one or more fields

Example:

To filter on exams with the id field matching a_value or another_value:

...&filter[id]=a_value,another_value

Filterable fields:
  • id (standard field)
  • begin_at (standard field)
  • end_at (standard field)
  • location (standard field)
  • ip_range (standard field)
  • max_people (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • visible (standard field)
  • name (standard field)
  • campus_id (standard field)
  • validated_at (standard field)
  • validator_id (standard field)
  • future : Return only exams which begins in the future. Can be one of: true, false
  • end (standard field)
  • validated (standard field)
range optional . Must be one of: id, begin_at, end_at, location, ip_range, max_people, created_at, updated_at, visible, name, campus_id, validated_at, validator_id.

Select on a particular range

Example:

To range on exams with the validator_id field between min_value and max_value:

...&range[validator_id]=min_value,max_value

Rangeable fields:
  • id
  • begin_at
  • end_at
  • location
  • ip_range
  • max_people
  • created_at
  • updated_at
  • visible
  • name
  • campus_id
  • validated_at
  • validator_id
page optional . Must be a Hash

The pagination params, as a hash

page[number] optional . Must be Fixnum

The current page

page[size] optional . Must be Fixnum

The number of items per page, defaults to 30, maximum 100

GET /v2/exams
200
[
  {
    "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  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "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

response = token.get("/v2/exams")
response.status
# => 200
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}]}]