live_help Notes

assignment_ind This action requires a token resource owner scoped on projects with enough privileges or an application with one of theses role(s): Advanced tutor, Advanced staff .

settings Params

Param name Description
project_id optional . Must be String

The project id or slug

user_id optional . Must be String

The user id or slug

projects_user optional , nil allowed . Must be a Hash
projects_user[project_id] required . Must be Fixnum

The project id.

projects_user[user_id] required . Must be Fixnum

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

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

The occurrence. Default to 0.

projects_user[final_mark] optional , nil allowed . Must be Fixnum

The final mark.

projects_user[retriable_at] optional , nil allowed . Must be DateTime

The retriable at.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/projects_users
{
  "projects_user": {
    "project_id": "2",
    "user_id": "3"
  }
}
201
{
  "id": 50,
  "occurrence": 0,
  "final_mark": null,
  "status": "in_progress",
  "validated?": null,
  "current_team_id": 50,
  "project": {
    "id": 2,
    "name": "Ordinary Wizarding Levels",
    "slug": "ordinary-wizarding-levels",
    "parent_id": null
  },
  "cursus_ids": [
    1
  ],
  "user": {
    "id": 3,
    "login": "gargamel",
    "url": "https://api.intra.42.fr/v2/users/gargamel"
  },
  "teams": [
    {
      "id": 50,
      "name": "gargamel's group",
      "url": "https://api.intra.42.fr/v2/teams/50",
      "final_mark": null,
      "project_id": 2,
      "created_at": "2017-03-06T15:20:29.187Z",
      "updated_at": "2017-03-06T15:20:29.252Z",
      "status": "in_progress",
      "terminating_at": null,
      "users": [
        {
          "id": 3,
          "login": "gargamel",
          "url": "https://api.intra.42.fr/v2/users/gargamel",
          "leader": true,
          "occurrence": 0,
          "validated": true,
          "projects_user_id": 50
        }
      ],
      "locked?": true,
      "validated?": null,
      "closed?": false,
      "repo_url": null,
      "repo_uuid": "intra-uuid-926c0a91-f060-4604-a136-91ffe84accdf-50",
      "locked_at": "2017-03-06T15:20:29.216Z",
      "closed_at": null,
      "project_session_id": 2
    }
  ]
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"projects_user":{"project_id":"2","user_id":"3"}}' "https://api.intra.42.fr/v2/projects_users"

{
  "id": 50,
  "occurrence": 0,
  "final_mark": null,
  "status": "in_progress",
  "validated?": null,
  "current_team_id": 50,
  "project": {
    "id": 2,
    "name": "Ordinary Wizarding Levels",
    "slug": "ordinary-wizarding-levels",
    "parent_id": null
  },
  "cursus_ids": [
    1
  ],
  "user": {
    "id": 3,
    "login": "gargamel",
    "url": "https://api.intra.42.fr/v2/users/gargamel"
  },
  "teams": [
    {
      "id": 50,
      "name": "gargamel's group",
      "url": "https://api.intra.42.fr/v2/teams/50",
      "final_mark": null,
      "project_id": 2,
      "created_at": "2017-03-06T15:20:29.187Z",
      "updated_at": "2017-03-06T15:20:29.252Z",
      "status": "in_progress",
      "terminating_at": null,
      "users": [
        {
          "id": 3,
          "login": "gargamel",
          "url": "https://api.intra.42.fr/v2/users/gargamel",
          "leader": true,
          "occurrence": 0,
          "validated": true,
          "projects_user_id": 50
        }
      ],
      "locked?": true,
      "validated?": null,
      "closed?": false,
      "repo_url": null,
      "repo_uuid": "intra-uuid-926c0a91-f060-4604-a136-91ffe84accdf-50",
      "locked_at": "2017-03-06T15:20:29.216Z",
      "closed_at": null,
      "project_session_id": 2
    }
  ]
}
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 = {projects_user: {project_id: "2", user_id: "3"}}
response = token.post("/v2/projects_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>50, "occurrence"=>0, "final_mark"=>nil, "status"=>"in_progress", "validated?"=>nil, "current_team_id"=>50, "project"=>{"id"=>2, "name"=>"Ordinary Wizarding Levels", "slug"=>"ordinary-wizarding-levels", "parent_id"=>nil}, "cursus_ids"=>[1], "user"=>{"id"=>3, "login"=>"gargamel", "url"=>"https://api.intra.42.fr/v2/users/gargamel"}, "teams"=>[{"id"=>50, "name"=>"gargamel's group", "url"=>"https://api.intra.42.fr/v2/teams/50", "final_mark"=>nil, "project_id"=>2, "created_at"=>"2017-03-06T15:20:29.187Z", "updated_at"=>"2017-03-06T15:20:29.252Z", "status"=>"in_progress", "terminating_at"=>nil, "users"=>[{"id"=>3, "login"=>"gargamel", "url"=>"https://api.intra.42.fr/v2/users/gargamel", "leader"=>true, "occurrence"=>0, "validated"=>true, "projects_user_id"=>50}], "locked?"=>true, "validated?"=>nil, "closed?"=>false, "repo_url"=>nil, "repo_uuid"=>"intra-uuid-926c0a91-f060-4604-a136-91ffe84accdf-50", "locked_at"=>"2017-03-06T15:20:29.216Z", "closed_at"=>nil, "project_session_id"=>2}]}