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
user_id required . Must be Integer

Freezed user id

expected_end_date required . Must be Date

The date when the agu will be automatically stopped

begin_date optional . Must be Date

The date when the agu started, defaulted to Today

is_free optional . Must be String

If true, the agu will not consume one of 3 user agu, can be overlapped with other agus

reason optional . Must be String

The reason of this freeze

POST /v2/anti_grav_units_users
{
  "anti_grav_units_user": {
    "expected_end_date": "2019-12-23",
    "begin_date": "2019-12-09",
    "user_id": 31461,
    "is_free": true
  }
}
201
{
  "id": 64,
  "user_id": 18763,
  "begin_date": "2019-12-09",
  "expected_end_date": "2019-12-23",
  "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 '{"anti_grav_units_user":{"expected_end_date":"2019-12-23","begin_date":"2019-12-09","user_id":31461,"is_free":true}}' "https://api.intra.42.fr/v2/anti_grav_units_users"

{
  "id": 64,
  "user_id": 18763,
  "begin_date": "2019-12-09",
  "expected_end_date": "2019-12-23",
  "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 = {anti_grav_units_user: {expected_end_date: "2019-12-23", begin_date: "2019-12-09", user_id: 31461, is_free: true}}
response = token.post("/v2/anti_grav_units_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>64, "user_id"=>18763, "begin_date"=>"2019-12-09", "expected_end_date"=>"2019-12-23", "created_at"=>"2019-12-09T14:17:15.986Z", "updated_at"=>"2019-12-09T14:17:15.986Z", "is_free"=>true, "close_id"=>65822}