GET /v2/quests
Return all the quests
GET /v2/cursus/:cursus_id/quests
Return all the quests of the given Cursus
GET /v2/campus/:campus_id/quests
Return all the quests of the given Campus
GET /v2/users/:user_id/quests
Return all the quests of the given User
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. MoreExample: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 MoreExample:
To filter on quests with the
...&filter[id]=a_value,another_value Filterable fields:
|
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 MoreExample:
To range on quests with the
...&range[position]=min_value,max_value Rangeable fields:
|
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 |
Examples
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}]