live_help Notes

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

settings Params

Param name Description
id required . Must be String

The requested id

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

The name.

event[begin_at] optional . Must be Fixnum

The begin at. .

event[end_at] optional . Must be Fixnum

The end at. . Beginning must be after ending.

event[description] optional . Must be String

The description.

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

The location. Maximum length is 255.

event[kind] optional . 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[prohibition_of_cancellation] optional , nil allowed . Must be Fixnum

The prohibition of cancellation.

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

The activate waitlist.

event[events_themes_attributes] optional , nil allowed . Must be an Array of nested elements

The events themes attributes.

event[events_themes_attributes][id] optional , nil allowed . Must be Fixnum

The id.

event[events_themes_attributes][theme_id] optional . Must be Fixnum

The theme id. Must be unique in the scope of a given event.

event[events_themes_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

event[events_themes_attributes][theme_attributes] optional , nil allowed . Must be an Array of nested elements

The theme attributes.

event[events_themes_attributes][theme_attributes][id] optional , nil allowed . Must be Fixnum

The id.

event[events_themes_attributes][theme_attributes][name] optional . Must be String

The name. Must be unique.

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.

PUT /v2/events/3
{
  "event": {
    "begin_at": "2017-11-25 13:43:10 UTC",
    "campus_ids": [
      "1"
    ],
    "cursus_ids": [
      "1"
    ],
    "events_themes_attributes": [
      {
        "theme_attributes": {
          "name": "Association"
        }
      },
      {
        "id": 58,
        "_destroy": "true"
      }
    ],
    "description": "A fucking great event",
    "end_at": "2017-11-29 13:43:10 UTC",
    "kind": "workshop",
    "location": "Holodeck",
    "max_people": "120",
    "prohibition_of_cancellation": 10,
    "name": "Rainbowcat festival 🌈"
  }
}
204
curl  -X PUT -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"],"events_themes_attributes":[{"theme_attributes":{"name":"Association"}},{"id":58,"_destroy":"true"}],"description":"A fucking great event","end_at":"2017-11-29 13:43:10 UTC","kind":"workshop","location":"Holodeck","max_people":"120","prohibition_of_cancellation":10,"name":"Rainbowcat festival 🌈"}}' "https://api.intra.42.fr/v2/events/3"
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"], events_themes_attributes: [{theme_attributes: {name: "Association"}}, {id: 58, _destroy: "true"}], description: "A fucking great event", end_at: "2017-11-29 13:43:10 UTC", kind: "workshop", location: "Holodeck", max_people: "120", prohibition_of_cancellation: 10, name: "Rainbowcat festival 🌈"}}
response = token.put("/v2/events/3", params: params)
response.status
# => 204
response.parsed
# =>