POST /v2/expertises/:expertise_id/expertises_users
Create an expertises user for the given Expertise
POST /v2/users/:user_id/expertises_users
Create an expertises user for the given User
POST /v2/expertises_users
Create an expertises user
live_help Notes
This action requires a token resource owner
scoped on profile with enough privileges
or an application with one of theses role(s):
assignment_ind
Advanced tutor
.
settings Params
Param name | Description |
---|---|
expertise_id |
optional
. Must be String
The expertise id or slug |
user_id |
optional
. Must be String
The user id or slug |
expertises_user | optional , nil allowed . Must be a Hash |
expertises_user[expertise_id] |
required
. Must be Fixnum
The expertise id. Must be unique in the scope of a given user. |
expertises_user[user_id] |
required
. Must be Fixnum
The user id. |
expertises_user[interested] |
optional
, nil allowed
. Must be one of: true , false .
Is it interested ? Default to false. |
expertises_user[value] |
required
. Must be Fixnum
The value. |
expertises_user[contact_me] |
optional
, nil allowed
. Must be one of: true , false .
Is it contact me ? Default to false. |
Examples
POST /v2/expertises_users
{
"expertises_user": {
"expertise_id": "2",
"user_id": "106",
"value": "1"
}
}
201
{
"id": 127,
"expertise_id": 2,
"interested": false,
"value": 1,
"contact_me": false,
"created_at": "2017-11-22T13:43:39.996Z",
"user_id": 106,
"expertise": {
"id": 2,
"name": "jQuery",
"slug": "jquery",
"url": "https://api.intra.42.fr/v2/expertises/jquery",
"kind": "other",
"created_at": "2017-11-22T13:41:01.779Z",
"expertises_users_url": "https://api.intra.42.fr/v2/expertises/jquery/expertises_users"
},
"user": {
"id": 106,
"login": "anaskywa",
"url": "https://api.intra.42.fr/v2/users/anaskywa"
}
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"expertises_user":{"expertise_id":"2","user_id":"106","value":"1"}}' "https://api.intra.42.fr/v2/expertises_users"
{
"id": 127,
"expertise_id": 2,
"interested": false,
"value": 1,
"contact_me": false,
"created_at": "2017-11-22T13:43:39.996Z",
"user_id": 106,
"expertise": {
"id": 2,
"name": "jQuery",
"slug": "jquery",
"url": "https://api.intra.42.fr/v2/expertises/jquery",
"kind": "other",
"created_at": "2017-11-22T13:41:01.779Z",
"expertises_users_url": "https://api.intra.42.fr/v2/expertises/jquery/expertises_users"
},
"user": {
"id": 106,
"login": "anaskywa",
"url": "https://api.intra.42.fr/v2/users/anaskywa"
}
}
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 = {expertises_user: {expertise_id: "2", user_id: "106", value: "1"}}
response = token.post("/v2/expertises_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>127, "expertise_id"=>2, "interested"=>false, "value"=>1, "contact_me"=>false, "created_at"=>"2017-11-22T13:43:39.996Z", "user_id"=>106, "expertise"=>{"id"=>2, "name"=>"jQuery", "slug"=>"jquery", "url"=>"https://api.intra.42.fr/v2/expertises/jquery", "kind"=>"other", "created_at"=>"2017-11-22T13:41:01.779Z", "expertises_users_url"=>"https://api.intra.42.fr/v2/expertises/jquery/expertises_users"}, "user"=>{"id"=>106, "login"=>"anaskywa", "url"=>"https://api.intra.42.fr/v2/users/anaskywa"}}