live_help Notes

chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
sort optional . Must be one of: id, cursus_id, campus_id, squad_size, created_at, updated_at.

The sort field. Sorted by created_at desc by default.

Example:

To sort on blocs on the fields created_at on a descending order and updated_at on a ascending order:

...&sort=-created_at,updated_at

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

comments powered by <span class='logo-disqus'>Disqus</span>
GET /v2/blocs
200
[
  {
    "id": 1,
    "campus_id": 5,
    "cursus_id": 1,
    "squad_size": 80,
    "created_at": "2017-11-22T13:41:20.665Z",
    "updated_at": "2017-11-22T13:41:20.665Z",
    "coalitions": [
      {
        "id": 1,
        "name": "Indiana goblins",
        "slug": "super-slug",
        "image_url": "https://admin.intra.42.fr/uploads/coalition/image/1/logo.svg",
        "color": "#1c7f08",
        "score": 54,
        "user_id": 38
      },
      {
        "id": 2,
        "name": "Kansas giants",
        "slug": "super-slug",
        "image_url": "https://admin.intra.42.fr/uploads/coalition/image/2/logo.svg",
        "color": "#087262",
        "score": 83,
        "user_id": 90
      }
    ]
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/blocs"

[
  {
    "id": 1,
    "campus_id": 5,
    "cursus_id": 1,
    "squad_size": 80,
    "created_at": "2017-11-22T13:41:20.665Z",
    "updated_at": "2017-11-22T13:41:20.665Z",
    "coalitions": [
      {
        "id": 1,
        "name": "Indiana goblins",
        "slug": "super-slug",
        "image_url": "https://admin.intra.42.fr/uploads/coalition/image/1/logo.svg",
        "color": "#1c7f08",
        "score": 54,
        "user_id": 38
      },
      {
        "id": 2,
        "name": "Kansas giants",
        "slug": "super-slug",
        "image_url": "https://admin.intra.42.fr/uploads/coalition/image/2/logo.svg",
        "color": "#087262",
        "score": 83,
        "user_id": 90
      }
    ]
  }
]
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/blocs")
response.status
# => 200
response.parsed
# => [{"id"=>1, "campus_id"=>5, "cursus_id"=>1, "squad_size"=>80, "created_at"=>"2017-11-22T13:41:20.665Z", "updated_at"=>"2017-11-22T13:41:20.665Z", "coalitions"=>[{"id"=>1, "name"=>"Indiana goblins", "slug"=>"super-slug", "image_url"=>"https://admin.intra.42.fr/uploads/coalition/image/1/logo.svg", "color"=>"#1c7f08", "score"=>54, "user_id"=>38}, {"id"=>2, "name"=>"Kansas giants", "slug"=>"super-slug", "image_url"=>"https://admin.intra.42.fr/uploads/coalition/image/2/logo.svg", "color"=>"#087262", "score"=>83, "user_id"=>90}]}]