live_help Notes

assignment This action requires one of theses roles: Tutor

settings Params

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

The team id.

teams_user[user_id] required . Must be Fixnum

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

teams_user[leader] optional , nil allowed . Must be one of: true, false.

Is it leader ? Default to false.

teams_user[validated] optional , nil allowed . Must be one of: true, false.

Is it validated ? Default to false.

teams_user[occurrence] optional , nil allowed . Must be Fixnum

The occurrence. Default to 0.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/teams_users
{
  "teams_user": {
    "leader": "false",
    "occurrence": "1",
    "team_id": "66",
    "user_id": "126",
    "validated": "false"
  }
}
201
{
  "id": 72,
  "team_id": 66,
  "user_id": 126,
  "created_at": "2017-11-21T17:32:27.425Z",
  "validated": false,
  "leader": false,
  "occurrence": 0,
  "team": {
    "id": 66,
    "name": "chewbche's group",
    "url": "https://api.intra.42.fr/v2/teams/66",
    "final_mark": null,
    "project_id": 1,
    "created_at": "2017-11-21T17:09:23.541Z",
    "updated_at": "2017-11-21T17:32:27.431Z",
    "status": "waiting_for_correction",
    "terminating_at": null,
    "users": [
      {
        "id": 124,
        "login": "chewbche",
        "url": "https://api.intra.42.fr/v2/users/chewbche",
        "leader": true,
        "occurrence": 0,
        "validated": true,
        "projects_user_id": 66
      },
      {
        "id": 126,
        "login": "anakskyw",
        "url": "https://api.intra.42.fr/v2/users/anakskyw",
        "leader": false,
        "occurrence": 0,
        "validated": false,
        "projects_user_id": 71
      }
    ],
    "locked?": true,
    "validated?": null,
    "closed?": true,
    "repo_url": null,
    "repo_uuid": "intra-uuid-37305e84-32a4-4a43-a7ec-828804a670b7-66",
    "locked_at": "2017-11-21T17:09:23.592Z",
    "closed_at": "2017-11-21T17:09:23.613Z",
    "project_session_id": 1
  },
  "user": {
    "id": 126,
    "login": "anakskyw",
    "url": "https://api.intra.42.fr/v2/users/anakskyw"
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"teams_user":{"leader":"false","occurrence":"1","team_id":"66","user_id":"126","validated":"false"}}' "https://api.intra.42.fr/v2/teams_users"

{
  "id": 72,
  "team_id": 66,
  "user_id": 126,
  "created_at": "2017-11-21T17:32:27.425Z",
  "validated": false,
  "leader": false,
  "occurrence": 0,
  "team": {
    "id": 66,
    "name": "chewbche's group",
    "url": "https://api.intra.42.fr/v2/teams/66",
    "final_mark": null,
    "project_id": 1,
    "created_at": "2017-11-21T17:09:23.541Z",
    "updated_at": "2017-11-21T17:32:27.431Z",
    "status": "waiting_for_correction",
    "terminating_at": null,
    "users": [
      {
        "id": 124,
        "login": "chewbche",
        "url": "https://api.intra.42.fr/v2/users/chewbche",
        "leader": true,
        "occurrence": 0,
        "validated": true,
        "projects_user_id": 66
      },
      {
        "id": 126,
        "login": "anakskyw",
        "url": "https://api.intra.42.fr/v2/users/anakskyw",
        "leader": false,
        "occurrence": 0,
        "validated": false,
        "projects_user_id": 71
      }
    ],
    "locked?": true,
    "validated?": null,
    "closed?": true,
    "repo_url": null,
    "repo_uuid": "intra-uuid-37305e84-32a4-4a43-a7ec-828804a670b7-66",
    "locked_at": "2017-11-21T17:09:23.592Z",
    "closed_at": "2017-11-21T17:09:23.613Z",
    "project_session_id": 1
  },
  "user": {
    "id": 126,
    "login": "anakskyw",
    "url": "https://api.intra.42.fr/v2/users/anakskyw"
  }
}
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 = {teams_user: {leader: "false", occurrence: "1", team_id: "66", user_id: "126", validated: "false"}}
response = token.post("/v2/teams_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>72, "team_id"=>66, "user_id"=>126, "created_at"=>"2017-11-21T17:32:27.425Z", "validated"=>false, "leader"=>false, "occurrence"=>0, "team"=>{"id"=>66, "name"=>"chewbche's group", "url"=>"https://api.intra.42.fr/v2/teams/66", "final_mark"=>nil, "project_id"=>1, "created_at"=>"2017-11-21T17:09:23.541Z", "updated_at"=>"2017-11-21T17:32:27.431Z", "status"=>"waiting_for_correction", "terminating_at"=>nil, "users"=>[{"id"=>124, "login"=>"chewbche", "url"=>"https://api.intra.42.fr/v2/users/chewbche", "leader"=>true, "occurrence"=>0, "validated"=>true, "projects_user_id"=>66}, {"id"=>126, "login"=>"anakskyw", "url"=>"https://api.intra.42.fr/v2/users/anakskyw", "leader"=>false, "occurrence"=>0, "validated"=>false, "projects_user_id"=>71}], "locked?"=>true, "validated?"=>nil, "closed?"=>true, "repo_url"=>nil, "repo_uuid"=>"intra-uuid-37305e84-32a4-4a43-a7ec-828804a670b7-66", "locked_at"=>"2017-11-21T17:09:23.592Z", "closed_at"=>"2017-11-21T17:09:23.613Z", "project_session_id"=>1}, "user"=>{"id"=>126, "login"=>"anakskyw", "url"=>"https://api.intra.42.fr/v2/users/anakskyw"}}