live_help Notes

chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
cursus_id optional . Must be String

The cursus id or slug

tag_id optional . Must be String

The tag id

sort optional . Must be one of: id, name, created_at, updated_at, slug.

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

Example:

To sort on notions on the fields updated_at on a descending order and slug on a ascending order:

...&sort=-updated_at,slug

filter optional . Must be one of: id, name, created_at, updated_at, slug.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • name (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • slug (standard field)
range optional . Must be one of: id, name, created_at, updated_at, slug.

Select on a particular range

Example:

To range on notions with the slug field between min_value and max_value:

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

Rangeable fields:
  • id
  • name
  • created_at
  • updated_at
  • slug
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/notions
200
[
  {
    "id": 10,
    "name": "Piscine OCaml - D08 - Object oriented programming 2/2",
    "slug": "piscine-ocaml-d08-object-oriented-programming-2-2",
    "created_at": "2017-11-22T13:41:24.091Z",
    "subnotions": [],
    "tags": [
      {
        "id": 6,
        "name": "Jour 13",
        "kind": "project"
      }
    ],
    "cursus": [
      {
        "id": 2,
        "created_at": "2017-11-22T13:41:00.825Z",
        "name": "42",
        "slug": "42"
      }
    ]
  },
  {
    "id": 9,
    "name": "Piscine Unity - D07 - GUI 3D, navmesh and raycasting",
    "slug": "piscine-unity-d07-gui-3d-navmesh-and-raycasting",
    "created_at": "2017-11-22T13:41:24.053Z",
    "subnotions": [],
    "tags": [
      {
        "id": 7,
        "name": "Bocal",
        "kind": "general"
      }
    ],
    "cursus": [
      {
        "id": 2,
        "created_at": "2017-11-22T13:41:00.825Z",
        "name": "42",
        "slug": "42"
      }
    ]
  },
  {
    "id": 8,
    "name": "Piscine OCaml - D05 - Imperative traits",
    "slug": "piscine-ocaml-d05-imperative-traits",
    "created_at": "2017-11-22T13:41:24.021Z",
    "subnotions": [],
    "tags": [
      {
        "id": 7,
        "name": "Bocal",
        "kind": "general"
      }
    ],
    "cursus": [
      {
        "id": 1,
        "created_at": "2017-11-22T13:41:00.750Z",
        "name": "Piscine C",
        "slug": "piscine-c"
      }
    ]
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/notions"

[
  {
    "id": 10,
    "name": "Piscine OCaml - D08 - Object oriented programming 2/2",
    "slug": "piscine-ocaml-d08-object-oriented-programming-2-2",
    "created_at": "2017-11-22T13:41:24.091Z",
    "subnotions": [],
    "tags": [
      {
        "id": 6,
        "name": "Jour 13",
        "kind": "project"
      }
    ],
    "cursus": [
      {
        "id": 2,
        "created_at": "2017-11-22T13:41:00.825Z",
        "name": "42",
        "slug": "42"
      }
    ]
  },
  {
    "id": 9,
    "name": "Piscine Unity - D07 - GUI 3D, navmesh and raycasting",
    "slug": "piscine-unity-d07-gui-3d-navmesh-and-raycasting",
    "created_at": "2017-11-22T13:41:24.053Z",
    "subnotions": [],
    "tags": [
      {
        "id": 7,
        "name": "Bocal",
        "kind": "general"
      }
    ],
    "cursus": [
      {
        "id": 2,
        "created_at": "2017-11-22T13:41:00.825Z",
        "name": "42",
        "slug": "42"
      }
    ]
  },
  {
    "id": 8,
    "name": "Piscine OCaml - D05 - Imperative traits",
    "slug": "piscine-ocaml-d05-imperative-traits",
    "created_at": "2017-11-22T13:41:24.021Z",
    "subnotions": [],
    "tags": [
      {
        "id": 7,
        "name": "Bocal",
        "kind": "general"
      }
    ],
    "cursus": [
      {
        "id": 1,
        "created_at": "2017-11-22T13:41:00.750Z",
        "name": "Piscine C",
        "slug": "piscine-c"
      }
    ]
  }
]
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/notions")
response.status
# => 200
response.parsed
# => [{"id"=>10, "name"=>"Piscine OCaml - D08 - Object oriented programming 2/2", "slug"=>"piscine-ocaml-d08-object-oriented-programming-2-2", "created_at"=>"2017-11-22T13:41:24.091Z", "subnotions"=>[], "tags"=>[{"id"=>6, "name"=>"Jour 13", "kind"=>"project"}], "cursus"=>[{"id"=>2, "created_at"=>"2017-11-22T13:41:00.825Z", "name"=>"42", "slug"=>"42"}]}, {"id"=>9, "name"=>"Piscine Unity - D07 - GUI 3D, navmesh and raycasting", "slug"=>"piscine-unity-d07-gui-3d-navmesh-and-raycasting", "created_at"=>"2017-11-22T13:41:24.053Z", "subnotions"=>[], "tags"=>[{"id"=>7, "name"=>"Bocal", "kind"=>"general"}], "cursus"=>[{"id"=>2, "created_at"=>"2017-11-22T13:41:00.825Z", "name"=>"42", "slug"=>"42"}]}, {"id"=>8, "name"=>"Piscine OCaml - D05 - Imperative traits", "slug"=>"piscine-ocaml-d05-imperative-traits", "created_at"=>"2017-11-22T13:41:24.021Z", "subnotions"=>[], "tags"=>[{"id"=>7, "name"=>"Bocal", "kind"=>"general"}], "cursus"=>[{"id"=>1, "created_at"=>"2017-11-22T13:41:00.750Z", "name"=>"Piscine C", "slug"=>"piscine-c"}]}]