live_help Notes

assignment This action requires one of theses roles: Advanced staff
POST /v2/anti_grav_units_users
{
  "expected_unfreezed_at": "2019-12-24 03:00:11 UTC",
  "user_id": 18763,
  "is_free": true
}
201
{
  "id": 64,
  "duration": 14,
  "user_id": 18763,
  "expected_unfreezed_at": "2019-12-23T14:16:39.669Z",
  "created_at": "2019-12-09T14:17:15.986Z",
  "updated_at": "2019-12-09T14:17:15.986Z",
  "is_free": true,
  "close_id": 65822
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"expected_unfreezed_at":"2019-12-24T03:00:11.455Z","user_id":18763,"is_free":true}' "https://api.intra.42.fr/v2/anti_grav_units_users"

{
  "id": 64,
  "duration": 14,
  "user_id": 18763,
  "expected_unfreezed_at": "2019-12-23T14:16:39.669Z",
  "created_at": "2019-12-09T14:17:15.986Z",
  "updated_at": "2019-12-09T14:17:15.986Z",
  "is_free": true,
  "close_id": 65822
}
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 = {expected_unfreezed_at: 2019-12-24 03:00:11 UTC, user_id: 18763, is_free: true}
response = token.post("/v2/anti_grav_units_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>64, "duration"=>14, "user_id"=>18763, "expected_unfreezed_at"=>"2019-12-23T14:16:39.669Z", "created_at"=>"2019-12-09T14:17:15.986Z", "updated_at"=>"2019-12-09T14:17:15.986Z", "is_free"=>true, "close_id"=>65822}