live_help Notes

assignment This action requires one of theses roles: Advanced tutor

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.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/achievements_users
{
  "achievements_user": {
    "achievement_id": "8",
    "user_id": "55"
  }
}
201
{
  "id": 55,
  "login": "jahutt",
  "url": "https://api.intra.42.fr/v2/users/jahutt",
  "created_at": "2017-03-06T15:20:05.941Z"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"achievements_user":{"achievement_id":"8","user_id":"55"}}' "https://api.intra.42.fr/v2/achievements_users"

{
  "id": 55,
  "login": "jahutt",
  "url": "https://api.intra.42.fr/v2/users/jahutt",
  "created_at": "2017-03-06T15:20:05.941Z"
}
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: "8", user_id: "55"}}
response = token.post("/v2/achievements_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>55, "login"=>"jahutt", "url"=>"https://api.intra.42.fr/v2/users/jahutt", "created_at"=>"2017-03-06T15:20:05.941Z"}