live_help Notes

chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
coalition_id optional . Must be String

The coalition id or slug

user_id optional . Must be String

The user id or slug

sort optional . Must be one of: id, coalition_id, user_id, created_at, updated_at, this_year_score, this_year_score_updated_at.

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

Example:

To sort on coalitions users on the fields this_year_score on a descending order and this_year_score_updated_at on a ascending order:

...&sort=-this_year_score,this_year_score_updated_at

filter optional . Must be one of: id, coalition_id, user_id, created_at, updated_at, this_year_score, this_year_score_updated_at, this_year_score_updated.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • coalition_id (standard field)
  • user_id (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • this_year_score (standard field)
  • this_year_score_updated_at (standard field)
  • this_year_score_updated (standard field)
range optional . Must be one of: id, coalition_id, user_id, created_at, updated_at, this_year_score, this_year_score_updated_at.

Select on a particular range

Example:

To range on coalitions users with the this_year_score_updated_at field between min_value and max_value:

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

Rangeable fields:
  • id
  • coalition_id
  • user_id
  • created_at
  • updated_at
  • this_year_score
  • this_year_score_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

coalitions_user optional , nil allowed . Must be a Hash
coalitions_user[coalition_id] optional . Must be Fixnum

The coalition id.

coalitions_user[user_id] optional . Must be Fixnum

The user id. Must be unique in the scope of a given coalition.

coalitions_user[this_year_score] optional . Must be Fixnum

The this year score.

coalitions_user[this_year_score_updated_at] optional , nil allowed . Must be DateTime

The this year score updated at.

GET /v2/coalitions_users
200
[
  {
    "id": 4,
    "coalition_id": 1,
    "user_id": 67,
    "created_at": "2017-11-22T13:42:09.775Z",
    "updated_at": "2017-11-22T13:42:09.775Z"
  },
  {
    "id": 3,
    "coalition_id": 1,
    "user_id": 25,
    "created_at": "2017-11-22T13:42:09.750Z",
    "updated_at": "2017-11-22T13:42:09.750Z"
  },
  {
    "id": 2,
    "coalition_id": 2,
    "user_id": 23,
    "created_at": "2017-11-22T13:42:09.723Z",
    "updated_at": "2017-11-22T13:42:09.723Z"
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/coalitions_users"

[
  {
    "id": 4,
    "coalition_id": 1,
    "user_id": 67,
    "created_at": "2017-11-22T13:42:09.775Z",
    "updated_at": "2017-11-22T13:42:09.775Z"
  },
  {
    "id": 3,
    "coalition_id": 1,
    "user_id": 25,
    "created_at": "2017-11-22T13:42:09.750Z",
    "updated_at": "2017-11-22T13:42:09.750Z"
  },
  {
    "id": 2,
    "coalition_id": 2,
    "user_id": 23,
    "created_at": "2017-11-22T13:42:09.723Z",
    "updated_at": "2017-11-22T13:42:09.723Z"
  }
]
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_users")
response.status
# => 200
response.parsed
# => [{"id"=>4, "coalition_id"=>1, "user_id"=>67, "created_at"=>"2017-11-22T13:42:09.775Z", "updated_at"=>"2017-11-22T13:42:09.775Z"}, {"id"=>3, "coalition_id"=>1, "user_id"=>25, "created_at"=>"2017-11-22T13:42:09.750Z", "updated_at"=>"2017-11-22T13:42:09.750Z"}, {"id"=>2, "coalition_id"=>2, "user_id"=>23, "created_at"=>"2017-11-22T13:42:09.723Z", "updated_at"=>"2017-11-22T13:42:09.723Z"}]