live_help Notes

assignment This action requires one of theses roles: Advanced staff, Events manager

settings Params

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

The name.

event[begin_at] required . Must be DateTime

The begin at.

event[end_at] required . Must be Fixnum

The end at. Beginning must be after ending.

event[description] required . Must be String

The description.

event[location] optional , nil allowed . Must be String

The location.

event[kind] required . Must be one of: pedago, rush, piscine, partnership, meet, conference, meet_up, event, association, speed_working, hackathon, workshop, challenge, other, extern.

The kind.

event[max_people] optional , nil allowed . Must be Fixnum

The max people.

event[cursus_ids] optional , nil allowed . Must be an array of Integer

The cursus ids.

event[campus_ids] optional , nil allowed . Must be an array of Integer

The campus ids.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/events
{
  "event": {
    "begin_at": "2017-11-25 13:43:10 UTC",
    "campus_ids": [
      "1"
    ],
    "cursus_ids": [
      "1"
    ],
    "description": "A fucking great event",
    "end_at": "2017-11-29 13:43:10 UTC",
    "kind": "workshop",
    "location": "Holodeck",
    "max_people": "120",
    "name": "Rainbowcat festival 🌈"
  }
}
201
{
  "id": 5,
  "name": "Rainbowcat festival 🌈",
  "description": "A fucking great event",
  "location": "Holodeck",
  "kind": "workshop",
  "max_people": 120,
  "nbr_subscribers": 0,
  "begin_at": "2017-11-25T13:43:10.000Z",
  "end_at": "2017-11-29T13:43:10.000Z",
  "campus_ids": [
    1
  ],
  "cursus_ids": [
    1
  ],
  "created_at": "2017-11-22T13:43:37.609Z",
  "updated_at": "2017-11-22T13:43:37.633Z"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"event":{"begin_at":"2017-11-25 13:43:10 UTC","campus_ids":["1"],"cursus_ids":["1"],"description":"A fucking great event","end_at":"2017-11-29 13:43:10 UTC","kind":"workshop","location":"Holodeck","max_people":"120","name":"Rainbowcat festival 🌈"}}' "https://api.intra.42.fr/v2/events"

{
  "id": 5,
  "name": "Rainbowcat festival 🌈",
  "description": "A fucking great event",
  "location": "Holodeck",
  "kind": "workshop",
  "max_people": 120,
  "nbr_subscribers": 0,
  "begin_at": "2017-11-25T13:43:10.000Z",
  "end_at": "2017-11-29T13:43:10.000Z",
  "campus_ids": [
    1
  ],
  "cursus_ids": [
    1
  ],
  "created_at": "2017-11-22T13:43:37.609Z",
  "updated_at": "2017-11-22T13:43:37.633Z"
}
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 = {event: {begin_at: "2017-11-25 13:43:10 UTC", campus_ids: ["1"], cursus_ids: ["1"], description: "A fucking great event", end_at: "2017-11-29 13:43:10 UTC", kind: "workshop", location: "Holodeck", max_people: "120", name: "Rainbowcat festival 🌈"}}
response = token.post("/v2/events", params: params)
response.status
# => 201
response.parsed
# => {"id"=>5, "name"=>"Rainbowcat festival 🌈", "description"=>"A fucking great event", "location"=>"Holodeck", "kind"=>"workshop", "max_people"=>120, "nbr_subscribers"=>0, "begin_at"=>"2017-11-25T13:43:10.000Z", "end_at"=>"2017-11-29T13:43:10.000Z", "campus_ids"=>[1], "cursus_ids"=>[1], "created_at"=>"2017-11-22T13:43:37.609Z", "updated_at"=>"2017-11-22T13:43:37.633Z"}