POST /v2/coalitions_users
Create a coalitions user
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
settings Params
Param name | Description |
---|---|
coalitions_user | optional , nil allowed . Must be a Hash |
coalitions_user[coalition_id] |
required
. Must be Fixnum
The coalition id. |
coalitions_user[user_id] |
required
. Must be Fixnum
The user id. Must be unique in the scope of a given coalition. |
coalitions_user[this_year_score] |
required
. Must be Fixnum
The this year score. |
coalitions_user[this_year_score_updated_at] |
optional
, nil allowed
. Must be DateTime
The this year score updated at. |
Examples
POST /v2/coalitions_users
{
"coalitions_user": {
"coalition_id": "2",
"user_id": "60"
}
}
201
{
"id": 5,
"coalition_id": 2,
"user_id": 60,
"created_at": "2017-11-22T13:43:31.350Z",
"updated_at": "2017-11-22T13:43:31.350Z"
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"coalitions_user":{"coalition_id":"2","user_id":"60"}}' "https://api.intra.42.fr/v2/coalitions_users"
{
"id": 5,
"coalition_id": 2,
"user_id": 60,
"created_at": "2017-11-22T13:43:31.350Z",
"updated_at": "2017-11-22T13:43:31.350Z"
}
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 = {coalitions_user: {coalition_id: "2", user_id: "60"}}
response = token.post("/v2/coalitions_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>5, "coalition_id"=>2, "user_id"=>60, "created_at"=>"2017-11-22T13:43:31.350Z", "updated_at"=>"2017-11-22T13:43:31.350Z"}