live_help Notes

chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
sort optional . Must be one of: id, name, created_at, updated_at, time_zone, language_id, slug, main_email, endpoint_id, vogsphere_id, content_email, time_of_community_service_started, companies_mail, address, zip, city, country, pro_needs_validation, logo, website, facebook, twitter, display_name.

The sort field. Sorted by id desc by default.

Example:

To sort on campus on the fields twitter on a descending order and display_name on a ascending order:

...&sort=-twitter,display_name

filter optional . Must be one of: id, name, created_at, updated_at, time_zone, language_id, slug, main_email, endpoint_id, vogsphere_id, content_email, time_of_community_service_started, companies_mail, address, zip, city, country, pro_needs_validation, logo, website, facebook, twitter, display_name.

Filtering on one or more fields

Example:

To filter on campus 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)
  • time_zone (standard field)
  • language_id (standard field)
  • slug (standard field)
  • main_email (standard field)
  • endpoint_id (standard field)
  • vogsphere_id (standard field)
  • content_email (standard field)
  • time_of_community_service_started (standard field)
  • companies_mail (standard field)
  • address (standard field)
  • zip (standard field)
  • city (standard field)
  • country (standard field)
  • pro_needs_validation (standard field)
  • logo (standard field)
  • website (standard field)
  • facebook (standard field)
  • twitter (standard field)
  • display_name (standard field)
range optional . Must be one of: id, name, created_at, updated_at, time_zone, language_id, slug, main_email, endpoint_id, vogsphere_id, content_email, time_of_community_service_started, companies_mail, address, zip, city, country, pro_needs_validation, logo, website, facebook, twitter, display_name.

Select on a particular range

Example:

To range on campus with the display_name field between min_value and max_value:

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

Rangeable fields:
  • id
  • name
  • created_at
  • updated_at
  • time_zone
  • language_id
  • slug
  • main_email
  • endpoint_id
  • vogsphere_id
  • content_email
  • time_of_community_service_started
  • companies_mail
  • address
  • zip
  • city
  • country
  • pro_needs_validation
  • logo
  • website
  • facebook
  • twitter
  • display_name
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

comments powered by <span class='logo-disqus'>Disqus</span>
GET /v2/campus
200
[
  {
    "id": 6,
    "name": "Paris",
    "time_zone": "Paris",
    "language": {
      "id": 1,
      "name": "Français",
      "identifier": "fr"
    },
    "users_count": 15,
    "vogsphere_id": 1,
    "endpoint": null
  },
  {
    "id": 5,
    "name": "Fremont",
    "time_zone": "Pacific Time (US & Canada)",
    "language": {
      "id": 2,
      "name": "English",
      "identifier": "en"
    },
    "users_count": 10,
    "vogsphere_id": 2,
    "endpoint": null
  },
  {
    "id": 4,
    "name": "Kiev",
    "time_zone": "Kyiv",
    "language": {
      "id": 2,
      "name": "English",
      "identifier": "en"
    },
    "users_count": 6,
    "vogsphere_id": null,
    "endpoint": null
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/campus"

[
  {
    "id": 6,
    "name": "Paris",
    "time_zone": "Paris",
    "language": {
      "id": 1,
      "name": "Français",
      "identifier": "fr"
    },
    "users_count": 15,
    "vogsphere_id": 1,
    "endpoint": null
  },
  {
    "id": 5,
    "name": "Fremont",
    "time_zone": "Pacific Time (US & Canada)",
    "language": {
      "id": 2,
      "name": "English",
      "identifier": "en"
    },
    "users_count": 10,
    "vogsphere_id": 2,
    "endpoint": null
  },
  {
    "id": 4,
    "name": "Kiev",
    "time_zone": "Kyiv",
    "language": {
      "id": 2,
      "name": "English",
      "identifier": "en"
    },
    "users_count": 6,
    "vogsphere_id": null,
    "endpoint": null
  }
]
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/campus")
response.status
# => 200
response.parsed
# => [{"id"=>6, "name"=>"Paris", "time_zone"=>"Paris", "language"=>{"id"=>1, "name"=>"Français", "identifier"=>"fr"}, "users_count"=>15, "vogsphere_id"=>1, "endpoint"=>nil}, {"id"=>5, "name"=>"Fremont", "time_zone"=>"Pacific Time (US & Canada)", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en"}, "users_count"=>10, "vogsphere_id"=>2, "endpoint"=>nil}, {"id"=>4, "name"=>"Kiev", "time_zone"=>"Kyiv", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en"}, "users_count"=>6, "vogsphere_id"=>nil, "endpoint"=>nil}]