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

cursus_id optional . Must be String

The cursus id or slug

sort optional . Must be one of: id, cursus_id, user_id, created_at, updated_at, end_at, begin_at, has_coalition, blackholed_at, level.

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

Example:

To sort on cursus users on the fields blackholed_at on a descending order and level on a ascending order:

...&sort=-blackholed_at,level

filter optional . Must be one of: id, cursus_id, user_id, created_at, updated_at, end_at, begin_at, has_coalition, blackholed_at, level, active, campus_id, end, future, blackholed.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • cursus_id (standard field)
  • user_id (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • end_at (standard field)
  • begin_at (standard field)
  • has_coalition (standard field)
  • blackholed_at (standard field)
  • level (standard field)
  • active : Only return active cursus_users. Can be one of: true, false
  • campus_id : Return cursus_users with primary campus of user equal to him.
  • end (standard field)
  • future : Return only cursus users which begins in the future. Can be one of: true, false
  • blackholed (standard field)
range optional . Must be one of: id, cursus_id, user_id, created_at, updated_at, end_at, begin_at, has_coalition, blackholed_at, level, level.

Select on a particular range

Example:

To range on cursus users with the level field between min_value and max_value:

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

Rangeable fields:
  • id
  • cursus_id
  • user_id
  • created_at
  • updated_at
  • end_at
  • begin_at
  • has_coalition
  • blackholed_at
  • level
  • level
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/cursus_users
200
[
  {
    "id": 126,
    "begin_at": "2016-12-16T07:41:39.516Z",
    "end_at": null,
    "grade": "Cadet",
    "level": 0.0,
    "skills": [],
    "cursus_id": 2,
    "has_coalition": true,
    "user": {
      "id": 126,
      "login": "darthcae",
      "url": "https://api.intra.42.fr/v2/users/darthcae"
    },
    "cursus": {
      "id": 2,
      "created_at": "2017-11-22T13:41:00.825Z",
      "name": "42",
      "slug": "42"
    }
  },
  {
    "id": 125,
    "begin_at": "2017-11-10T21:38:19.158Z",
    "end_at": null,
    "grade": "Cadet",
    "level": 0.0,
    "skills": [],
    "cursus_id": 1,
    "has_coalition": true,
    "user": {
      "id": 125,
      "login": "sebulseb",
      "url": "https://api.intra.42.fr/v2/users/sebulseb"
    },
    "cursus": {
      "id": 1,
      "created_at": "2017-11-22T13:41:00.750Z",
      "name": "Piscine C",
      "slug": "piscine-c"
    }
  },
  {
    "id": 124,
    "begin_at": "2017-07-22T03:48:20.016Z",
    "end_at": null,
    "grade": "Cadet",
    "level": 0.0,
    "skills": [],
    "cursus_id": 2,
    "has_coalition": true,
    "user": {
      "id": 124,
      "login": "hsolo2",
      "url": "https://api.intra.42.fr/v2/users/hsolo2"
    },
    "cursus": {
      "id": 2,
      "created_at": "2017-11-22T13:41:00.825Z",
      "name": "42",
      "slug": "42"
    }
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/cursus_users"

[
  {
    "id": 126,
    "begin_at": "2016-12-16T07:41:39.516Z",
    "end_at": null,
    "grade": "Cadet",
    "level": 0.0,
    "skills": [],
    "cursus_id": 2,
    "has_coalition": true,
    "user": {
      "id": 126,
      "login": "darthcae",
      "url": "https://api.intra.42.fr/v2/users/darthcae"
    },
    "cursus": {
      "id": 2,
      "created_at": "2017-11-22T13:41:00.825Z",
      "name": "42",
      "slug": "42"
    }
  },
  {
    "id": 125,
    "begin_at": "2017-11-10T21:38:19.158Z",
    "end_at": null,
    "grade": "Cadet",
    "level": 0.0,
    "skills": [],
    "cursus_id": 1,
    "has_coalition": true,
    "user": {
      "id": 125,
      "login": "sebulseb",
      "url": "https://api.intra.42.fr/v2/users/sebulseb"
    },
    "cursus": {
      "id": 1,
      "created_at": "2017-11-22T13:41:00.750Z",
      "name": "Piscine C",
      "slug": "piscine-c"
    }
  },
  {
    "id": 124,
    "begin_at": "2017-07-22T03:48:20.016Z",
    "end_at": null,
    "grade": "Cadet",
    "level": 0.0,
    "skills": [],
    "cursus_id": 2,
    "has_coalition": true,
    "user": {
      "id": 124,
      "login": "hsolo2",
      "url": "https://api.intra.42.fr/v2/users/hsolo2"
    },
    "cursus": {
      "id": 2,
      "created_at": "2017-11-22T13:41:00.825Z",
      "name": "42",
      "slug": "42"
    }
  }
]
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/cursus_users")
response.status
# => 200
response.parsed
# => [{"id"=>126, "begin_at"=>"2016-12-16T07:41:39.516Z", "end_at"=>nil, "grade"=>"Cadet", "level"=>0.0, "skills"=>[], "cursus_id"=>2, "has_coalition"=>true, "user"=>{"id"=>126, "login"=>"darthcae", "url"=>"https://api.intra.42.fr/v2/users/darthcae"}, "cursus"=>{"id"=>2, "created_at"=>"2017-11-22T13:41:00.825Z", "name"=>"42", "slug"=>"42"}}, {"id"=>125, "begin_at"=>"2017-11-10T21:38:19.158Z", "end_at"=>nil, "grade"=>"Cadet", "level"=>0.0, "skills"=>[], "cursus_id"=>1, "has_coalition"=>true, "user"=>{"id"=>125, "login"=>"sebulseb", "url"=>"https://api.intra.42.fr/v2/users/sebulseb"}, "cursus"=>{"id"=>1, "created_at"=>"2017-11-22T13:41:00.750Z", "name"=>"Piscine C", "slug"=>"piscine-c"}}, {"id"=>124, "begin_at"=>"2017-07-22T03:48:20.016Z", "end_at"=>nil, "grade"=>"Cadet", "level"=>0.0, "skills"=>[], "cursus_id"=>2, "has_coalition"=>true, "user"=>{"id"=>124, "login"=>"hsolo2", "url"=>"https://api.intra.42.fr/v2/users/hsolo2"}, "cursus"=>{"id"=>2, "created_at"=>"2017-11-22T13:41:00.825Z", "name"=>"42", "slug"=>"42"}}]