PATCH /v2/anti_grav_units_users/:id
Update an anti grav units user
PUT /v2/anti_grav_units_users/:id
Update an anti grav units user
live_help Notes
assignment
This action requires one of theses roles:
Advanced staff
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
anti_grav_units_user | optional , nil allowed . Must be a Hash |
anti_grav_units_user[user_id] |
optional
. Must be Integer
Freezed user id |
anti_grav_units_user[anti_grav_unit_id] |
optional
, nil allowed
. Must be Integer
Must refer to the AntiGravUnit related. |
anti_grav_units_user[begin_date] |
optional
, nil allowed
. Must be Date
The date when the agu started, defaulted to Today |
anti_grav_units_user[expected_end_date] |
optional
. Must be Date
The date when the agu will be automatically stopped |
anti_grav_units_user[reason] |
optional
, nil allowed
. Must be String
The reason of this freeze |
anti_grav_units_user[is_free] |
optional
, nil allowed
. Must be String
If true, the agu will not consume one of 3 user agu, can be overlapped with other agus |
Examples
PUT /v2/anti_grav_units_users/64
{
"anti_grav_units_user": {
"begin_date": "2019-12-09",
"expected_end_date": "2020-03-10",
"is_free": false
}
}
204
{
"anti_grav_units_user": {
"id": 64,
"user_id": 18763,
"anti_grav_unit_id": 1,
"begin_date": "2019-12-09",
"expected_end_date": "2020-03-10",
"reason": "other",
"is_free": false,
"close_id": 65822,
"created_at": "2019-12-09T14:17:15.986Z",
"updated_at": "2019-12-09T14:17:15.986Z"
}
}
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"anti_grav_units_user":{"begin_date":"2019-12-09","expected_end_date":"2020-03-10","is_free":false}}' "https://api.intra.42.fr/v2/anti_grav_units_users/64"
{
"anti_grav_units_user": {
"id": 64,
"user_id": 18763,
"anti_grav_unit_id": 1,
"begin_date": "2019-12-09",
"expected_end_date": "2020-03-10",
"reason": "other",
"is_free": false,
"close_id": 65822,
"created_at": "2019-12-09T14:17:15.986Z",
"updated_at": "2019-12-09T14:17:15.986Z"
}
}
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 = {anti_grav_units_user: {begin_date: "2019-12-09", expected_end_date: "2020-03-10", is_free: false}}
response = token.put("/v2/anti_grav_units_users/64", params: params)
response.status
# => 204
response.parsed
# => {"anti_grav_units_user"=>{"id"=>64, "user_id"=>18763, "anti_grav_unit_id"=>1, "begin_date"=>"2019-12-09", "expected_end_date"=>"2020-03-10", "reason"=>"other", "is_free"=>false, "close_id"=>65822, "created_at"=>"2019-12-09T14:17:15.986Z", "updated_at"=>"2019-12-09T14:17:15.986Z"}}