live_help Notes

chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
user_id optional . Must be String

The user id or slug

bloc_id optional . Must be String

The bloc id

sort optional . Must be one of: id, bloc_id, user_id, name, image, slug, created_at, updated_at, color, cover.

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

Example:

To sort on coalitions on the fields color on a descending order and cover on a ascending order:

...&sort=-color,cover

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

coalition optional , nil allowed . Must be a Hash
coalition[bloc_id] optional . Must be Fixnum

The bloc id.

coalition[user_id] optional . Must be Fixnum

The user id.

coalition[name] optional . Must be String

The name. Must be unique in the scope of a given bloc.

coalition[image] optional . Must be File

The image.

coalition[slug] optional , nil allowed . Must be String

The slug.

coalition[color] optional . Must be String

The color.

coalition[cover] optional , nil allowed . Must be File

The cover.

GET /v2/coalitions
200
[
  {
    "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
  },
  {
    "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
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/coalitions"

[
  {
    "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
  },
  {
    "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
  }
]
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/coalitions")
response.status
# => 200
response.parsed
# => [{"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}, {"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}]