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": "34",
    "user_id": "64",
    "validated": "false"
  }
}
201
{
  "id": 53,
  "team_id": 34,
  "user_id": 64,
  "created_at": "2017-03-06T15:20:40.303Z",
  "validated": false,
  "leader": false,
  "occurrence": 0,
  "team": {
    "id": 34,
    "name": "cdooku's group",
    "url": "https://api.intra.42.fr/v2/teams/34",
    "final_mark": null,
    "project_id": 1,
    "created_at": "2017-03-06T14:59:11.365Z",
    "updated_at": "2017-03-06T15:20:40.308Z",
    "status": "waiting_for_correction",
    "terminating_at": null,
    "users": [
      {
        "id": 66,
        "login": "jbinks2",
        "url": "https://api.intra.42.fr/v2/users/jbinks2",
        "leader": true,
        "occurrence": 0,
        "validated": true,
        "projects_user_id": 34
      },
      {
        "id": 64,
        "login": "ruhaako",
        "url": "https://api.intra.42.fr/v2/users/ruhaako",
        "leader": false,
        "occurrence": 0,
        "validated": false,
        "projects_user_id": 51
      }
    ],
    "locked?": true,
    "validated?": null,
    "closed?": true,
    "repo_url": null,
    "repo_uuid": "intra-uuid-e595b115-a857-4ea9-bc02-fde6947e9480-34",
    "locked_at": "2017-03-06T14:59:11.442Z",
    "closed_at": "2017-03-06T14:59:11.471Z",
    "project_session_id": 1
  },
  "user": {
    "id": 64,
    "login": "ruhaako",
    "url": "https://api.intra.42.fr/v2/users/ruhaako"
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"teams_user":{"leader":"false","occurrence":"1","team_id":"34","user_id":"64","validated":"false"}}' "https://api.intra.42.fr/v2/teams_users"

{
  "id": 53,
  "team_id": 34,
  "user_id": 64,
  "created_at": "2017-03-06T15:20:40.303Z",
  "validated": false,
  "leader": false,
  "occurrence": 0,
  "team": {
    "id": 34,
    "name": "cdooku's group",
    "url": "https://api.intra.42.fr/v2/teams/34",
    "final_mark": null,
    "project_id": 1,
    "created_at": "2017-03-06T14:59:11.365Z",
    "updated_at": "2017-03-06T15:20:40.308Z",
    "status": "waiting_for_correction",
    "terminating_at": null,
    "users": [
      {
        "id": 66,
        "login": "jbinks2",
        "url": "https://api.intra.42.fr/v2/users/jbinks2",
        "leader": true,
        "occurrence": 0,
        "validated": true,
        "projects_user_id": 34
      },
      {
        "id": 64,
        "login": "ruhaako",
        "url": "https://api.intra.42.fr/v2/users/ruhaako",
        "leader": false,
        "occurrence": 0,
        "validated": false,
        "projects_user_id": 51
      }
    ],
    "locked?": true,
    "validated?": null,
    "closed?": true,
    "repo_url": null,
    "repo_uuid": "intra-uuid-e595b115-a857-4ea9-bc02-fde6947e9480-34",
    "locked_at": "2017-03-06T14:59:11.442Z",
    "closed_at": "2017-03-06T14:59:11.471Z",
    "project_session_id": 1
  },
  "user": {
    "id": 64,
    "login": "ruhaako",
    "url": "https://api.intra.42.fr/v2/users/ruhaako"
  }
}
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: "34", user_id: "64", validated: "false"}}
response = token.post("/v2/teams_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>53, "team_id"=>34, "user_id"=>64, "created_at"=>"2017-03-06T15:20:40.303Z", "validated"=>false, "leader"=>false, "occurrence"=>0, "team"=>{"id"=>34, "name"=>"cdooku's group", "url"=>"https://api.intra.42.fr/v2/teams/34", "final_mark"=>nil, "project_id"=>1, "created_at"=>"2017-03-06T14:59:11.365Z", "updated_at"=>"2017-03-06T15:20:40.308Z", "status"=>"waiting_for_correction", "terminating_at"=>nil, "users"=>[{"id"=>66, "login"=>"jbinks2", "url"=>"https://api.intra.42.fr/v2/users/jbinks2", "leader"=>true, "occurrence"=>0, "validated"=>true, "projects_user_id"=>34}, {"id"=>64, "login"=>"ruhaako", "url"=>"https://api.intra.42.fr/v2/users/ruhaako", "leader"=>false, "occurrence"=>0, "validated"=>false, "projects_user_id"=>51}], "locked?"=>true, "validated?"=>nil, "closed?"=>true, "repo_url"=>nil, "repo_uuid"=>"intra-uuid-e595b115-a857-4ea9-bc02-fde6947e9480-34", "locked_at"=>"2017-03-06T14:59:11.442Z", "closed_at"=>"2017-03-06T14:59:11.471Z", "project_session_id"=>1}, "user"=>{"id"=>64, "login"=>"ruhaako", "url"=>"https://api.intra.42.fr/v2/users/ruhaako"}}