POST /v2/anti_grav_units_users
Create an anti grav units user
Create an AntiGravUnitsUser, if is_free is true then the AGU user will not loose an agu or freeze time.
This is the api for creating agu that ends in the future. If you are looking for creating agu in the past to delay the blackhole, please go to the following link. POST /v2/users/:user_id/free_past_agu
live_help Notes
assignment
This action requires one of theses roles:
Advanced staff
settings Params
Param name | Description |
---|---|
anti_grav_units_user | optional , nil allowed . Must be a Hash |
anti_grav_units_user[user_id] |
required
. 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] |
required
. 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
POST /v2/anti_grav_units_users
{
"anti_grav_units_user": {
"begin_date": "2019-12-09",
"expected_end_date": "2020-02-10",
"user_id": 80962,
"is_free": true,
"anti_grav_unit_id": 1
}
}
201
{
"anti_grav_units_user": {
"id": 64,
"user_id": 18763,
"anti_grav_unit_id": 1,
"begin_date": "2019-12-09",
"expected_end_date": "2020-02-10",
"reason": "other",
"is_free": true,
"close_id": 65822,
"created_at": "2019-12-09T14:17:15.986Z",
"updated_at": "2019-12-09T14:17:15.986Z"
}
}
curl -X POST -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-02-10","user_id":80962,"is_free":true,"anti_grav_unit_id":1}}' "https://api.intra.42.fr/v2/anti_grav_units_users"
{
"anti_grav_units_user": {
"id": 64,
"user_id": 18763,
"anti_grav_unit_id": 1,
"begin_date": "2019-12-09",
"expected_end_date": "2020-02-10",
"reason": "other",
"is_free": true,
"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-02-10", user_id: 80962, is_free: true, anti_grav_unit_id: 1}}
response = token.post("/v2/anti_grav_units_users", params: params)
response.status
# => 201
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-02-10", "reason"=>"other", "is_free"=>true, "close_id"=>65822, "created_at"=>"2019-12-09T14:17:15.986Z", "updated_at"=>"2019-12-09T14:17:15.986Z"}}