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

end_date optional . Must be Date

The date when the agu stopped, if set the user will not be close

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
{
  "expected_end_date": "2019-12-09",
  "begin_date": "2019-12-23",
  "user_id": 18763,
  "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 '{"expected_end_date":"2019-12-09","begin_date":"2019-12-23","user_id":18763,"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 = {expected_end_date: "2019-12-09", begin_date: "2019-12-23", user_id: 18763, 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}