live_help Notes

assignment This action requires one of theses roles: Achievements manager

settings Params

Param name Description
achievements_user optional , nil allowed . Must be a Hash
achievements_user[user_id] required . Must be Fixnum

The user id. Must be unique in the scope of a given achievement.

achievements_user[achievement_id] required . Must be Fixnum

The achievement id.

achievements_user[nbr_of_success] optional , nil allowed . Must be Fixnum

The nbr of success.

achievements_user[rewarded] optional , nil allowed . Must be one of: true, false.

Is it rewarded ? Default to false.

POST /v2/achievements_users
{
  "achievements_user": {
    "achievement_id": "1",
    "user_id": "29"
  }
}
201
{
  "id": 127,
  "user_id": 29,
  "login": "askywalk",
  "url": "https://api.intra.42.fr/v2/users/askywalk",
  "created_at": "2017-11-22T13:43:26.572Z"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"achievements_user":{"achievement_id":"1","user_id":"29"}}' "https://api.intra.42.fr/v2/achievements_users"

{
  "id": 127,
  "user_id": 29,
  "login": "askywalk",
  "url": "https://api.intra.42.fr/v2/users/askywalk",
  "created_at": "2017-11-22T13:43:26.572Z"
}
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 = {achievements_user: {achievement_id: "1", user_id: "29"}}
response = token.post("/v2/achievements_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>127, "user_id"=>29, "login"=>"askywalk", "url"=>"https://api.intra.42.fr/v2/users/askywalk", "created_at"=>"2017-11-22T13:43:26.572Z"}