live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
campus optional , nil allowed . Must be a Hash
campus[name] required . Must be String

The name. Must be unique.

campus[time_zone] optional , nil allowed . Must be String

The time zone.

campus[language_id] required . Must be Fixnum

The language id.

campus[slug] optional , nil allowed . Must be String

The slug.

campus[main_email] optional , nil allowed . Must be String

The main email.

campus[endpoint_id] optional , nil allowed . Must be Fixnum

The endpoint id.

campus[vogsphere_id] optional , nil allowed . Must be Fixnum

The vogsphere id.

campus[content_email] optional , nil allowed . Must be String

The content email.

campus[time_of_community_service_started] optional , nil allowed . Must be String

The time of community service started.

campus[companies_mail] optional , nil allowed . Must be String

The companies mail.

campus[address] required . Must be String

The address.

campus[zip] required . Must be String

The zip.

campus[city] required . Must be String

The city.

campus[country] required . Must be String

The country.

campus[pro_needs_validation] optional , nil allowed . Must be one of: true, false.

Is it pro needs validation ? Default to false.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/campus
{
  "campus": {
    "address": "230 Smith Point",
    "city": "Ritchieville",
    "country": "Bangladesh",
    "language_id": "1",
    "name": "Macedonia1",
    "zip": "68260-9569"
  }
}
201
{
  "id": 8,
  "name": "Macedonia1",
  "time_zone": null,
  "language": {
    "id": 1,
    "name": "Français",
    "identifier": "fr"
  },
  "users_count": 0,
  "vogsphere_id": null,
  "endpoint": null
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"campus":{"address":"230 Smith Point","city":"Ritchieville","country":"Bangladesh","language_id":"1","name":"Macedonia1","zip":"68260-9569"}}' "https://api.intra.42.fr/v2/campus"

{
  "id": 8,
  "name": "Macedonia1",
  "time_zone": null,
  "language": {
    "id": 1,
    "name": "Français",
    "identifier": "fr"
  },
  "users_count": 0,
  "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

params = {campus: {address: "230 Smith Point", city: "Ritchieville", country: "Bangladesh", language_id: "1", name: "Macedonia1", zip: "68260-9569"}}
response = token.post("/v2/campus", params: params)
response.status
# => 201
response.parsed
# => {"id"=>8, "name"=>"Macedonia1", "time_zone"=>nil, "language"=>{"id"=>1, "name"=>"Français", "identifier"=>"fr"}, "users_count"=>0, "vogsphere_id"=>nil, "endpoint"=>nil}