GET /v2/campus
Return all the campus
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 , email_extension , help_url , active , open_to_job_offers .
The sort field. Sorted by id desc by default. MoreExample:To sort on campus on the fields active on a descending order and open_to_job_offers on a ascending order: ...&sort=-active,open_to_job_offers |
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 , email_extension , help_url , active , open_to_job_offers .
Filtering on one or more fields MoreExample:
To filter on campus with the
...&filter[id]=a_value,another_value Filterable fields:
|
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 , email_extension , help_url , active , open_to_job_offers .
Select on a particular range MoreExample:
To range on campus with the
...&range[open_to_job_offers]=min_value,max_value Rangeable fields:
|
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 |
Examples
GET /v2/campus
200
[
{
"id": 6,
"name": "Paris",
"time_zone": "Europe/Paris",
"language": {
"id": 1,
"name": "Français",
"identifier": "fr"
},
"users_count": 19,
"vogsphere_id": 1,
"endpoint": null
},
{
"id": 5,
"name": "Fremont",
"time_zone": "America/Los_Angeles",
"language": {
"id": 2,
"name": "English",
"identifier": "en"
},
"users_count": 16,
"vogsphere_id": 2,
"endpoint": null
},
{
"id": 4,
"name": "Kiev",
"time_zone": "Europe/Kiev",
"language": {
"id": 2,
"name": "English",
"identifier": "en"
},
"users_count": 22,
"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": "Europe/Paris",
"language": {
"id": 1,
"name": "Français",
"identifier": "fr"
},
"users_count": 19,
"vogsphere_id": 1,
"endpoint": null
},
{
"id": 5,
"name": "Fremont",
"time_zone": "America/Los_Angeles",
"language": {
"id": 2,
"name": "English",
"identifier": "en"
},
"users_count": 16,
"vogsphere_id": 2,
"endpoint": null
},
{
"id": 4,
"name": "Kiev",
"time_zone": "Europe/Kiev",
"language": {
"id": 2,
"name": "English",
"identifier": "en"
},
"users_count": 22,
"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"=>"Europe/Paris", "language"=>{"id"=>1, "name"=>"Français", "identifier"=>"fr"}, "users_count"=>19, "vogsphere_id"=>1, "endpoint"=>nil}, {"id"=>5, "name"=>"Fremont", "time_zone"=>"America/Los_Angeles", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en"}, "users_count"=>16, "vogsphere_id"=>2, "endpoint"=>nil}, {"id"=>4, "name"=>"Kiev", "time_zone"=>"Europe/Kiev", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en"}, "users_count"=>22, "vogsphere_id"=>nil, "endpoint"=>nil}]