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": "1",
    "user_id": "1"
  }
}
201
{
  "id": 69,
  "occurrence": 0,
  "final_mark": null,
  "status": "in_progress",
  "validated?": null,
  "current_team_id": 69,
  "project": {
    "id": 1,
    "name": "Libft",
    "slug": "libft",
    "parent_id": null
  },
  "cursus_ids": [
    1
  ],
  "user": {
    "id": 1,
    "login": "jeanne",
    "url": "https://api.intra.42.fr/v2/users/jeanne"
  },
  "teams": [
    {
      "id": 69,
      "name": "jeanne's group",
      "url": "https://api.intra.42.fr/v2/teams/69",
      "final_mark": null,
      "project_id": 1,
      "created_at": "2017-11-22T13:43:56.555Z",
      "updated_at": "2017-11-22T13:43:56.625Z",
      "status": "in_progress",
      "terminating_at": null,
      "users": [
        {
          "id": 1,
          "login": "jeanne",
          "url": "https://api.intra.42.fr/v2/users/jeanne",
          "leader": true,
          "occurrence": 0,
          "validated": true,
          "projects_user_id": 69
        }
      ],
      "locked?": true,
      "validated?": null,
      "closed?": false,
      "repo_url": null,
      "repo_uuid": "intra-uuid-d9a02ebd-ecdb-46fd-8ce8-ecdc4ef9352c-69",
      "locked_at": "2017-11-22T13:43:56.581Z",
      "closed_at": null,
      "project_session_id": 1
    }
  ]
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"projects_user":{"project_id":"1","user_id":"1"}}' "https://api.intra.42.fr/v2/projects_users"

{
  "id": 69,
  "occurrence": 0,
  "final_mark": null,
  "status": "in_progress",
  "validated?": null,
  "current_team_id": 69,
  "project": {
    "id": 1,
    "name": "Libft",
    "slug": "libft",
    "parent_id": null
  },
  "cursus_ids": [
    1
  ],
  "user": {
    "id": 1,
    "login": "jeanne",
    "url": "https://api.intra.42.fr/v2/users/jeanne"
  },
  "teams": [
    {
      "id": 69,
      "name": "jeanne's group",
      "url": "https://api.intra.42.fr/v2/teams/69",
      "final_mark": null,
      "project_id": 1,
      "created_at": "2017-11-22T13:43:56.555Z",
      "updated_at": "2017-11-22T13:43:56.625Z",
      "status": "in_progress",
      "terminating_at": null,
      "users": [
        {
          "id": 1,
          "login": "jeanne",
          "url": "https://api.intra.42.fr/v2/users/jeanne",
          "leader": true,
          "occurrence": 0,
          "validated": true,
          "projects_user_id": 69
        }
      ],
      "locked?": true,
      "validated?": null,
      "closed?": false,
      "repo_url": null,
      "repo_uuid": "intra-uuid-d9a02ebd-ecdb-46fd-8ce8-ecdc4ef9352c-69",
      "locked_at": "2017-11-22T13:43:56.581Z",
      "closed_at": null,
      "project_session_id": 1
    }
  ]
}
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: "1", user_id: "1"}}
response = token.post("/v2/projects_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>69, "occurrence"=>0, "final_mark"=>nil, "status"=>"in_progress", "validated?"=>nil, "current_team_id"=>69, "project"=>{"id"=>1, "name"=>"Libft", "slug"=>"libft", "parent_id"=>nil}, "cursus_ids"=>[1], "user"=>{"id"=>1, "login"=>"jeanne", "url"=>"https://api.intra.42.fr/v2/users/jeanne"}, "teams"=>[{"id"=>69, "name"=>"jeanne's group", "url"=>"https://api.intra.42.fr/v2/teams/69", "final_mark"=>nil, "project_id"=>1, "created_at"=>"2017-11-22T13:43:56.555Z", "updated_at"=>"2017-11-22T13:43:56.625Z", "status"=>"in_progress", "terminating_at"=>nil, "users"=>[{"id"=>1, "login"=>"jeanne", "url"=>"https://api.intra.42.fr/v2/users/jeanne", "leader"=>true, "occurrence"=>0, "validated"=>true, "projects_user_id"=>69}], "locked?"=>true, "validated?"=>nil, "closed?"=>false, "repo_url"=>nil, "repo_uuid"=>"intra-uuid-d9a02ebd-ecdb-46fd-8ce8-ecdc4ef9352c-69", "locked_at"=>"2017-11-22T13:43:56.581Z", "closed_at"=>nil, "project_session_id"=>1}]}