live_help Notes

assignment This action requires one of theses roles: Advanced tutor
chrome_reader_mode This resource is paginated by 30 items

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

sort optional . Must be one of: id, name, slug, kind, internal_name, duration, ancestry, description, guild_size, guild_prct, cursus_id, campus_id, created_at, updated_at, grade_id, position, mails, certificate_id, unlock_all_projects, tries_number, success_number, close_on_fail, mails_from.

The sort field. Sorted by id asc by default.

Example:

To sort on quests on the fields close_on_fail on a descending order and mails_from on a ascending order:

...&sort=-close_on_fail,mails_from

filter optional . Must be one of: id, name, slug, kind, internal_name, description, cursus_id, campus_id, created_at, updated_at, grade_id, position.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • name (standard field)
  • slug (standard field)
  • kind (standard field)
  • internal_name (standard field)
  • description (standard field)
  • cursus_id (standard field)
  • campus_id (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • grade_id (standard field)
  • position (standard field)
range optional . Must be one of: id, name, slug, kind, internal_name, description, cursus_id, campus_id, created_at, updated_at, grade_id, position.

Select on a particular range

Example:

To range on quests with the position field between min_value and max_value:

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

Rangeable fields:
  • id
  • name
  • slug
  • kind
  • internal_name
  • description
  • cursus_id
  • campus_id
  • created_at
  • updated_at
  • grade_id
  • position
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/quests
200
[
  {
    "id": 1,
    "name": "Level 14",
    "slug": "level-14",
    "kind": "main",
    "internal_name": null,
    "description": "Reach the level 14.",
    "cursus_id": 2,
    "campus_id": null,
    "created_at": "2017-11-22T13:42:11.464Z",
    "updated_at": "2017-11-22T13:42:11.464Z",
    "grade_id": null,
    "position": 1,
    "grade": null,
    "cursus": {
      "id": 2,
      "created_at": "2017-11-22T13:41:00.825Z",
      "name": "42",
      "slug": "42"
    },
    "campus": null
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/quests"

[
  {
    "id": 1,
    "name": "Level 14",
    "slug": "level-14",
    "kind": "main",
    "internal_name": null,
    "description": "Reach the level 14.",
    "cursus_id": 2,
    "campus_id": null,
    "created_at": "2017-11-22T13:42:11.464Z",
    "updated_at": "2017-11-22T13:42:11.464Z",
    "grade_id": null,
    "position": 1,
    "grade": null,
    "cursus": {
      "id": 2,
      "created_at": "2017-11-22T13:41:00.825Z",
      "name": "42",
      "slug": "42"
    },
    "campus": 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/quests")
response.status
# => 200
response.parsed
# => [{"id"=>1, "name"=>"Level 14", "slug"=>"level-14", "kind"=>"main", "internal_name"=>nil, "description"=>"Reach the level 14.", "cursus_id"=>2, "campus_id"=>nil, "created_at"=>"2017-11-22T13:42:11.464Z", "updated_at"=>"2017-11-22T13:42:11.464Z", "grade_id"=>nil, "position"=>1, "grade"=>nil, "cursus"=>{"id"=>2, "created_at"=>"2017-11-22T13:41:00.825Z", "name"=>"42", "slug"=>"42"}, "campus"=>nil}]