live_help Notes

assignment This action requires one of theses roles: Tutor

settings Params

Param name Description
user_id optional . Must be String

The user id or slug

languages_user optional , nil allowed . Must be a Hash
languages_user[language_id] required . Must be Fixnum

The language id.

languages_user[user_id] optional , nil allowed . Must be Fixnum

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

languages_user[position] optional , nil allowed . Must be Fixnum

The position.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/languages_users
{
  "languages_user": {
    "language_id": "3",
    "position": "1",
    "user_id": "7"
  }
}
201
{
  "id": 70,
  "language_id": 3,
  "user_id": 7,
  "position": 1,
  "created_at": "2017-03-06T15:20:17.630Z"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"languages_user":{"language_id":"3","position":"1","user_id":"7"}}' "https://api.intra.42.fr/v2/languages_users"

{
  "id": 70,
  "language_id": 3,
  "user_id": 7,
  "position": 1,
  "created_at": "2017-03-06T15:20:17.630Z"
}
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 = {languages_user: {language_id: "3", position: "1", user_id: "7"}}
response = token.post("/v2/languages_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>70, "language_id"=>3, "user_id"=>7, "position"=>1, "created_at"=>"2017-03-06T15:20:17.630Z"}