live_help Notes

assignment This action requires one of theses roles: Basic staff
chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
sort optional . Must be one of: id, url, secret, description, created_at, updated_at, active.

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

Example:

To sort on endpoints on the fields updated_at on a descending order and active on a ascending order:

...&sort=-updated_at,active

filter optional . Must be one of: id, url, secret, description, created_at, updated_at, active.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • url (standard field)
  • secret (standard field)
  • description (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • active (standard field)
range optional . Must be one of: id, url, secret, description, created_at, updated_at, active.

Select on a particular range

Example:

To range on endpoints with the active field between min_value and max_value:

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

Rangeable fields:
  • id
  • url
  • secret
  • description
  • created_at
  • updated_at
  • active
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/endpoints?page=1
200
[
  {
    "id": 1,
    "url": "http://evil.machine.ai",
    "description": "The endpoint for the evil machine",
    "created_at": "2016-05-06T08:45:06.194Z",
    "updated_at": "2016-05-06T08:45:06.194Z",
    "campus": []
  },
  {
    "id": 2,
    "url": "http://burning.endpoint.io",
    "description": "Another endpoint",
    "created_at": "2016-05-06T08:45:06.194Z",
    "updated_at": "2016-05-06T08:45:06.194Z",
    "campus": []
  },
  {
    "id": 3,
    "url": "https://intra.42.jp",
    "description": "The tokyo endpoint",
    "created_at": "2016-05-06T08:45:06.194Z",
    "updated_at": "2016-05-06T08:49:40.574Z",
    "campus": [
      {
        "id": 9,
        "name": "Tokyo",
        "time_zone": "Asia/Tokyo",
        "language": {
          "id": 2,
          "name": "English",
          "identifier": "en",
          "created_at": "2015-04-14T16:07:38.122Z",
          "updated_at": "2015-04-14T16:07:38.122Z"
        },
        "users_count": 1
      }
    ]
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/endpoints?page=1"

[
  {
    "id": 1,
    "url": "http://evil.machine.ai",
    "description": "The endpoint for the evil machine",
    "created_at": "2016-05-06T08:45:06.194Z",
    "updated_at": "2016-05-06T08:45:06.194Z",
    "campus": []
  },
  {
    "id": 2,
    "url": "http://burning.endpoint.io",
    "description": "Another endpoint",
    "created_at": "2016-05-06T08:45:06.194Z",
    "updated_at": "2016-05-06T08:45:06.194Z",
    "campus": []
  },
  {
    "id": 3,
    "url": "https://intra.42.jp",
    "description": "The tokyo endpoint",
    "created_at": "2016-05-06T08:45:06.194Z",
    "updated_at": "2016-05-06T08:49:40.574Z",
    "campus": [
      {
        "id": 9,
        "name": "Tokyo",
        "time_zone": "Asia/Tokyo",
        "language": {
          "id": 2,
          "name": "English",
          "identifier": "en",
          "created_at": "2015-04-14T16:07:38.122Z",
          "updated_at": "2015-04-14T16:07:38.122Z"
        },
        "users_count": 1
      }
    ]
  }
]
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/endpoints?page=1")
response.status
# => 200
response.parsed
# => [{"id"=>1, "url"=>"http://evil.machine.ai", "description"=>"The endpoint for the evil machine", "created_at"=>"2016-05-06T08:45:06.194Z", "updated_at"=>"2016-05-06T08:45:06.194Z", "campus"=>[]}, {"id"=>2, "url"=>"http://burning.endpoint.io", "description"=>"Another endpoint", "created_at"=>"2016-05-06T08:45:06.194Z", "updated_at"=>"2016-05-06T08:45:06.194Z", "campus"=>[]}, {"id"=>3, "url"=>"https://intra.42.jp", "description"=>"The tokyo endpoint", "created_at"=>"2016-05-06T08:45:06.194Z", "updated_at"=>"2016-05-06T08:49:40.574Z", "campus"=>[{"id"=>9, "name"=>"Tokyo", "time_zone"=>"Asia/Tokyo", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en", "created_at"=>"2015-04-14T16:07:38.122Z", "updated_at"=>"2015-04-14T16:07:38.122Z"}, "users_count"=>1}]}]