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
sort optional . Must be one of: id, current_points, max_points, created_at, updated_at, cursus_id, campus_id.

The sort field. Sorted by created_at desc by default.

Example:

To sort on pools on the fields cursus_id on a descending order and campus_id on a ascending order:

...&sort=-cursus_id,campus_id

filter optional . Must be one of: id, current_points, max_points, created_at, updated_at, cursus_id, campus_id.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • current_points (standard field)
  • max_points (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • cursus_id (standard field)
  • campus_id (standard field)
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/pools?page=1

[
  {
    "id": 25,
    "current_points": 0,
    "max_points": 400,
    "cursus_id": 1,
    "campus_id": 12
  },
  {
    "id": 19,
    "current_points": 110,
    "max_points": 400,
    "cursus_id": 1,
    "campus_id": 9
  },
  {
    "id": 18,
    "current_points": 40,
    "max_points": 600,
    "cursus_id": 1,
    "campus_id": 8
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/pools?page=1"

[
  {
    "id": 25,
    "current_points": 0,
    "max_points": 400,
    "cursus_id": 1,
    "campus_id": 12
  },
  {
    "id": 19,
    "current_points": 110,
    "max_points": 400,
    "cursus_id": 1,
    "campus_id": 9
  },
  {
    "id": 18,
    "current_points": 40,
    "max_points": 600,
    "cursus_id": 1,
    "campus_id": 8
  }
]
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/pools?page=1")
response.status
# => 
response.parsed
# => [{"id"=>25, "current_points"=>0, "max_points"=>400, "cursus_id"=>1, "campus_id"=>12}, {"id"=>19, "current_points"=>110, "max_points"=>400, "cursus_id"=>1, "campus_id"=>9}, {"id"=>18, "current_points"=>40, "max_points"=>600, "cursus_id"=>1, "campus_id"=>8}]