POST /v2/projects_users/register_childs_and_scales
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):
42network, Advanced tutor
.
settings Params
| Param name | Description |
|---|---|
| scales |
optional
. Must be Hash
The scales to apply to the sub projects |
| projects_user | optional , nil allowed . Must be a Hash |
| projects_user[id] |
optional
, nil allowed
. Must be Fixnum
The id. |
| 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[created_at] |
optional
, nil allowed
. Must be DateTime
The created at. |
| projects_user[updated_at] |
optional
, nil allowed
. Must be DateTime
The updated at. |
| 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. |
| projects_user[marked_at] |
optional
, nil allowed
. Must be DateTime
The marked at. |
| projects_user[status] |
optional
, nil allowed
. Must be String
The status. Default to unknown. |
| projects_user[skip_check_permission] |
optional
, nil allowed
. Must be String
The skip check permission. |
Examples
POST /v2/projects_users/register_childs_and_scales
{
"projects_user": {
"user_id": 39962,
"project_id": 2561
},
"scales": {
"2562": 100,
"2563": 115
}
}
200
{
"id": 3609981,
"occurrence": 0,
"final_mark": null,
"status": "in_progress",
"validated?": null,
"current_team_id": 5598029,
"project": {
"id": 2561,
"name": "Test Childs",
"slug": "test-childs",
"parent_id": null
},
"cursus_ids": [
21
],
"marked_at": null,
"marked": false,
"retriable_at": null,
"created_at": "2024-07-18T12:06:40.573Z",
"updated_at": "2024-07-18T12:06:40.573Z",
"user": {},
"teams": [
{
"id": 5598029,
"name": "ct-39962's group",
"url": "http://localhost:13000/v2/teams/5598029",
"final_mark": null,
"project_id": 2561,
"created_at": "2024-07-18T12:06:40.638Z",
"updated_at": "2024-07-18T12:06:40.763Z",
"status": "in_progress",
"terminating_at": null,
"users": [
{
"id": 39962
}
],
"locked?": true,
"validated?": null,
"closed?": true,
"repo_url": null,
"repo_uuid": "intra-uuid",
"locked_at": "2024-07-18T12:06:40.720Z",
"closed_at": "2024-07-18T12:06:40.741Z",
"project_session_id": 11961,
"project_gitlab_path": null
}
]
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"projects_user":{"user_id":39962,"project_id":2561},"scales":{"2562":100,"2563":115}}' "https://api.intra.42.fr/v2/projects_users/register_childs_and_scales"
{
"id": 3609981,
"occurrence": 0,
"final_mark": null,
"status": "in_progress",
"validated?": null,
"current_team_id": 5598029,
"project": {
"id": 2561,
"name": "Test Childs",
"slug": "test-childs",
"parent_id": null
},
"cursus_ids": [
21
],
"marked_at": null,
"marked": false,
"retriable_at": null,
"created_at": "2024-07-18T12:06:40.573Z",
"updated_at": "2024-07-18T12:06:40.573Z",
"user": {},
"teams": [
{
"id": 5598029,
"name": "ct-39962's group",
"url": "http://localhost:13000/v2/teams/5598029",
"final_mark": null,
"project_id": 2561,
"created_at": "2024-07-18T12:06:40.638Z",
"updated_at": "2024-07-18T12:06:40.763Z",
"status": "in_progress",
"terminating_at": null,
"users": [
{
"id": 39962
}
],
"locked?": true,
"validated?": null,
"closed?": true,
"repo_url": null,
"repo_uuid": "intra-uuid",
"locked_at": "2024-07-18T12:06:40.720Z",
"closed_at": "2024-07-18T12:06:40.741Z",
"project_session_id": 11961,
"project_gitlab_path": null
}
]
}
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: {user_id: 39962, project_id: 2561}, scales: {2562: 100, 2563: 115}}
response = token.post("/v2/projects_users/register_childs_and_scales", params: params)
response.status
# => 200
response.parsed
# => {"id"=>3609981, "occurrence"=>0, "final_mark"=>nil, "status"=>"in_progress", "validated?"=>nil, "current_team_id"=>5598029, "project"=>{"id"=>2561, "name"=>"Test Childs", "slug"=>"test-childs", "parent_id"=>nil}, "cursus_ids"=>[21], "marked_at"=>nil, "marked"=>false, "retriable_at"=>nil, "created_at"=>"2024-07-18T12:06:40.573Z", "updated_at"=>"2024-07-18T12:06:40.573Z", "user"=>{}, "teams"=>[{"id"=>5598029, "name"=>"ct-39962's group", "url"=>"http://localhost:13000/v2/teams/5598029", "final_mark"=>nil, "project_id"=>2561, "created_at"=>"2024-07-18T12:06:40.638Z", "updated_at"=>"2024-07-18T12:06:40.763Z", "status"=>"in_progress", "terminating_at"=>nil, "users"=>[{"id"=>39962}], "locked?"=>true, "validated?"=>nil, "closed?"=>true, "repo_url"=>nil, "repo_uuid"=>"intra-uuid", "locked_at"=>"2024-07-18T12:06:40.720Z", "closed_at"=>"2024-07-18T12:06:40.741Z", "project_session_id"=>11961, "project_gitlab_path"=>nil}]}