live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
bloc_deadline optional , nil allowed . Must be a Hash
bloc_deadline[bloc_id] required . Must be Fixnum

The bloc id.

bloc_deadline[begin_at] required . Must be DateTime

The begin at.

bloc_deadline[end_at] required . Must be DateTime

The end at.

bloc_deadline[coalition_id] optional , nil allowed . Must be Fixnum

The coalition id.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/bloc_deadlines
{
  "bloc_deadline": {
    "begin_at": "2022-11-29",
    "bloc_id": "1",
    "coalition_id": "2",
    "end_at": "2023-11-29"
  }
}
201
{
  "id": 6,
  "bloc_id": 1,
  "coalition_id": 2,
  "begin_at": "2022-11-29T00:00:00.000Z",
  "end_at": "2023-11-29T00:00:00.000Z",
  "created_at": "2017-11-22T13:43:28.263Z",
  "updated_at": "2017-11-22T13:43:28.263Z"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"bloc_deadline":{"begin_at":"2022-11-29","bloc_id":"1","coalition_id":"2","end_at":"2023-11-29"}}' "https://api.intra.42.fr/v2/bloc_deadlines"

{
  "id": 6,
  "bloc_id": 1,
  "coalition_id": 2,
  "begin_at": "2022-11-29T00:00:00.000Z",
  "end_at": "2023-11-29T00:00:00.000Z",
  "created_at": "2017-11-22T13:43:28.263Z",
  "updated_at": "2017-11-22T13:43:28.263Z"
}
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 = {bloc_deadline: {begin_at: "2022-11-29", bloc_id: "1", coalition_id: "2", end_at: "2023-11-29"}}
response = token.post("/v2/bloc_deadlines", params: params)
response.status
# => 201
response.parsed
# => {"id"=>6, "bloc_id"=>1, "coalition_id"=>2, "begin_at"=>"2022-11-29T00:00:00.000Z", "end_at"=>"2023-11-29T00:00:00.000Z", "created_at"=>"2017-11-22T13:43:28.263Z", "updated_at"=>"2017-11-22T13:43:28.263Z"}