POST /v2/projects
Create a project
live_help Notes
Advanced tutor
settings Params
Param name | Description |
---|---|
project | optional , nil allowed . Must be a Hash |
project[name] |
required
. Must be String
The name. |
project[terminating_after] |
optional
, nil allowed
. Must be String
The terminating after. |
project[exam] |
optional
, nil allowed
. Must be one of: true , false .
Is it exam ? Default to false. |
project[has_mark] |
optional
, nil allowed
. Must be one of: true , false .
Is it has mark ? Default to true. |
project[repository] |
required
. Must be String
The repository. |
project[git_id] |
optional
, nil allowed
. Must be Fixnum
The git id. |
project[has_git] |
optional
, nil allowed
. Must be one of: true , false .
Is it has git ? Default to true. |
project[is_subscriptable] |
optional
, nil allowed
. Must be String
The is subscriptable. |
project[inherited_team] |
optional
, nil allowed
. Must be one of: true , false .
Is it inherited team ? Default to false. |
project[minimum_mark] |
optional
, nil allowed
. Must be String
The minimum mark. |
project[parent_id] |
optional
, nil allowed
. Must be Fixnum
The parent id. |
project[max_people] |
optional
, nil allowed
. Must be String
The max people. |
project[visible] |
optional
, nil allowed
. Must be one of: true , false .
Is it visible ? Default to false. |
project[cursus_ids] |
optional
, nil allowed
. Must be an array of Integer
The cursus ids. |
project[campus_ids] |
optional
, nil allowed
. Must be an array of Integer
The campus ids. |
project[authors_user_ids] |
optional
, nil allowed
. Must be an array of Integer
The authors user ids. |
project[notion_ids] |
optional
, nil allowed
. Must be an array of Integer
The notion ids. |
project[project_sessions_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The project sessions attributes. |
project[project_sessions_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
project[project_sessions_attributes][campus_id] |
optional
, nil allowed
. Must be Fixnum
The campus id. |
project[project_sessions_attributes][cursus_id] |
optional
, nil allowed
. Must be Fixnum
The cursus id. |
project[project_sessions_attributes][estimate_time] |
optional
, nil allowed
. Must be Fixnum
The estimate time. |
project[project_sessions_attributes][created_at] |
optional
, nil allowed
. Must be DateTime
The created at. |
project[project_sessions_attributes][updated_at] |
optional
, nil allowed
. Must be DateTime
The updated at. |
project[project_sessions_attributes][begin_at] |
optional
, nil allowed
. Must be DateTime
The begin at. |
project[project_sessions_attributes][end_at] |
optional
, nil allowed
. Must be DateTime
The end at. |
project[project_sessions_attributes][max_people] |
optional
, nil allowed
. Must be Fixnum
The max people. |
project[project_sessions_attributes][duration_days] |
optional
, nil allowed
. Must be Fixnum
The duration days. |
project[project_sessions_attributes][terminating_after] |
optional
, nil allowed
. Must be Fixnum
The terminating after. |
project[project_sessions_attributes][solo] |
optional
, nil allowed
. Must be one of: true , false .
Is it solo ? Default to false. |
project[project_sessions_attributes][is_subscriptable] |
optional
, nil allowed
. Must be one of: true , false .
Is it is subscriptable ? Default to true. |
project[project_sessions_attributes][minimum_mark] |
required
. Must be Fixnum
The minimum mark. |
project[project_sessions_attributes][team_behaviour] |
required
. Must be one of: user , upload , by_rule , none .
The team behaviour. |
project[project_sessions_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
project[evaluations_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The evaluations attributes. |
project[evaluations_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
project[evaluations_attributes][kind] |
optional
, nil allowed
. Must be one of: scale , upload .
The kind. |
project[evaluations_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
project[attachments_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The attachments attributes. |
project[attachments_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
project[attachments_attributes][language_id] |
required
. Must be Fixnum
The language id. |
project[attachments_attributes][kind] |
optional
, nil allowed
. Must be one of: code , pdf , link , document , video .
The kind. |
project[attachments_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
project[attachments_attributes][untranslatable] |
optional
, nil allowed
. Must be one of: true , false .
Is it untranslatable ? Default to false. |
project[attachments_attributes][attachable_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The attachable attributes. |
project[projects_rules_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The projects rules attributes. |
Examples
POST /v2/projects
{
"project": {
"campus_ids": [
"6",
"4",
"2"
],
"cursus_ids": [
"2"
],
"description": "Cleanse williamsburg brooklyn shabby chic pinterest kickstarter diy.",
"has_git": "true",
"has_mark": "true",
"is_subscriptable": "true",
"name": "Butter In a Lordly Dish",
"project_sessions_attributes": [
{
"campus_id": "",
"cursus_id": "",
"estimate_time": "2592000",
"is_subscriptable": "true",
"minimum_mark": "77",
"solo": "true",
"team_behaviour": "user"
},
{
"campus_id": "",
"cursus_id": "2",
"estimate_time": "2592000",
"is_subscriptable": "true",
"minimum_mark": "77",
"solo": "true",
"team_behaviour": "user"
}
],
"visible": "true"
}
}
201
{
"id": 6,
"name": "Butter In a Lordly Dish",
"slug": "butter-in-a-lordly-dish",
"difficulty": 5000,
"description": "Cleanse williamsburg brooklyn shabby chic pinterest kickstarter diy.",
"parent": null,
"children": [],
"objectives": null,
"attachments": [],
"created_at": "2017-11-22T13:43:54.544Z",
"updated_at": "2017-11-22T13:43:54.647Z",
"exam": false,
"cursus": [
{
"id": 2,
"created_at": "2017-11-22T13:41:00.825Z",
"name": "42",
"slug": "42"
}
],
"campus": [
{
"id": 6,
"name": "Paris",
"time_zone": "Europe/Paris",
"language": {
"id": 1,
"name": "Français",
"identifier": "fr",
"created_at": "2017-11-22T13:40:59.462Z",
"updated_at": "2017-11-22T13:40:59.462Z"
},
"users_count": 19,
"vogsphere_id": 1
},
{
"id": 4,
"name": "Kiev",
"time_zone": "Europe/Kiev",
"language": {
"id": 2,
"name": "English",
"identifier": "en",
"created_at": "2017-11-22T13:40:59.465Z",
"updated_at": "2017-11-22T13:40:59.465Z"
},
"users_count": 22,
"vogsphere_id": null
},
{
"id": 2,
"name": "Johannesburg",
"time_zone": "Africa/Johannesburg",
"language": {
"id": 2,
"name": "English",
"identifier": "en",
"created_at": "2017-11-22T13:40:59.465Z",
"updated_at": "2017-11-22T13:40:59.465Z"
},
"users_count": 26,
"vogsphere_id": 1
}
],
"skills": [],
"videos": [],
"tags": [],
"project_sessions": [
{
"id": 7,
"solo": true,
"begin_at": null,
"end_at": null,
"difficulty": 5000,
"estimate_time": 2592000,
"duration_days": null,
"terminating_after": null,
"project_id": 6,
"campus_id": null,
"cursus_id": null,
"created_at": "2017-11-22T13:43:54.566Z",
"updated_at": "2017-11-22T13:43:54.566Z",
"max_people": null,
"is_subscriptable": true,
"scales": [],
"uploads": [],
"team_behaviour": "user",
"minimum_mark": 77
},
{
"id": 8,
"solo": true,
"begin_at": null,
"end_at": null,
"difficulty": 5000,
"estimate_time": 2592000,
"duration_days": null,
"terminating_after": null,
"project_id": 6,
"campus_id": null,
"cursus_id": 2,
"created_at": "2017-11-22T13:43:54.574Z",
"updated_at": "2017-11-22T13:43:54.574Z",
"max_people": null,
"is_subscriptable": true,
"scales": [],
"uploads": [],
"team_behaviour": "user",
"minimum_mark": 77
}
]
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"project":{"campus_ids":["6","4","2"],"cursus_ids":["2"],"description":"Cleanse williamsburg brooklyn shabby chic pinterest kickstarter diy.","has_git":"true","has_mark":"true","is_subscriptable":"true","name":"Butter In a Lordly Dish","project_sessions_attributes":[{"campus_id":"","cursus_id":"","estimate_time":"2592000","is_subscriptable":"true","minimum_mark":"77","solo":"true","team_behaviour":"user"},{"campus_id":"","cursus_id":"2","estimate_time":"2592000","is_subscriptable":"true","minimum_mark":"77","solo":"true","team_behaviour":"user"}],"visible":"true"}}' "https://api.intra.42.fr/v2/projects"
{
"id": 6,
"name": "Butter In a Lordly Dish",
"slug": "butter-in-a-lordly-dish",
"difficulty": 5000,
"description": "Cleanse williamsburg brooklyn shabby chic pinterest kickstarter diy.",
"parent": null,
"children": [],
"objectives": null,
"attachments": [],
"created_at": "2017-11-22T13:43:54.544Z",
"updated_at": "2017-11-22T13:43:54.647Z",
"exam": false,
"cursus": [
{
"id": 2,
"created_at": "2017-11-22T13:41:00.825Z",
"name": "42",
"slug": "42"
}
],
"campus": [
{
"id": 6,
"name": "Paris",
"time_zone": "Europe/Paris",
"language": {
"id": 1,
"name": "Français",
"identifier": "fr",
"created_at": "2017-11-22T13:40:59.462Z",
"updated_at": "2017-11-22T13:40:59.462Z"
},
"users_count": 19,
"vogsphere_id": 1
},
{
"id": 4,
"name": "Kiev",
"time_zone": "Europe/Kiev",
"language": {
"id": 2,
"name": "English",
"identifier": "en",
"created_at": "2017-11-22T13:40:59.465Z",
"updated_at": "2017-11-22T13:40:59.465Z"
},
"users_count": 22,
"vogsphere_id": null
},
{
"id": 2,
"name": "Johannesburg",
"time_zone": "Africa/Johannesburg",
"language": {
"id": 2,
"name": "English",
"identifier": "en",
"created_at": "2017-11-22T13:40:59.465Z",
"updated_at": "2017-11-22T13:40:59.465Z"
},
"users_count": 26,
"vogsphere_id": 1
}
],
"skills": [],
"videos": [],
"tags": [],
"project_sessions": [
{
"id": 7,
"solo": true,
"begin_at": null,
"end_at": null,
"difficulty": 5000,
"estimate_time": 2592000,
"duration_days": null,
"terminating_after": null,
"project_id": 6,
"campus_id": null,
"cursus_id": null,
"created_at": "2017-11-22T13:43:54.566Z",
"updated_at": "2017-11-22T13:43:54.566Z",
"max_people": null,
"is_subscriptable": true,
"scales": [],
"uploads": [],
"team_behaviour": "user",
"minimum_mark": 77
},
{
"id": 8,
"solo": true,
"begin_at": null,
"end_at": null,
"difficulty": 5000,
"estimate_time": 2592000,
"duration_days": null,
"terminating_after": null,
"project_id": 6,
"campus_id": null,
"cursus_id": 2,
"created_at": "2017-11-22T13:43:54.574Z",
"updated_at": "2017-11-22T13:43:54.574Z",
"max_people": null,
"is_subscriptable": true,
"scales": [],
"uploads": [],
"team_behaviour": "user",
"minimum_mark": 77
}
]
}
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 = {project: {campus_ids: ["6", "4", "2"], cursus_ids: ["2"], description: "Cleanse williamsburg brooklyn shabby chic pinterest kickstarter diy.", has_git: "true", has_mark: "true", is_subscriptable: "true", name: "Butter In a Lordly Dish", project_sessions_attributes: [{campus_id: "", cursus_id: "", estimate_time: "2592000", is_subscriptable: "true", minimum_mark: "77", solo: "true", team_behaviour: "user"}, {campus_id: "", cursus_id: "2", estimate_time: "2592000", is_subscriptable: "true", minimum_mark: "77", solo: "true", team_behaviour: "user"}], visible: "true"}}
response = token.post("/v2/projects", params: params)
response.status
# => 201
response.parsed
# => {"id"=>6, "name"=>"Butter In a Lordly Dish", "slug"=>"butter-in-a-lordly-dish", "difficulty"=>5000, "description"=>"Cleanse williamsburg brooklyn shabby chic pinterest kickstarter diy.", "parent"=>nil, "children"=>[], "objectives"=>nil, "attachments"=>[], "created_at"=>"2017-11-22T13:43:54.544Z", "updated_at"=>"2017-11-22T13:43:54.647Z", "exam"=>false, "cursus"=>[{"id"=>2, "created_at"=>"2017-11-22T13:41:00.825Z", "name"=>"42", "slug"=>"42"}], "campus"=>[{"id"=>6, "name"=>"Paris", "time_zone"=>"Europe/Paris", "language"=>{"id"=>1, "name"=>"Français", "identifier"=>"fr", "created_at"=>"2017-11-22T13:40:59.462Z", "updated_at"=>"2017-11-22T13:40:59.462Z"}, "users_count"=>19, "vogsphere_id"=>1}, {"id"=>4, "name"=>"Kiev", "time_zone"=>"Europe/Kiev", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en", "created_at"=>"2017-11-22T13:40:59.465Z", "updated_at"=>"2017-11-22T13:40:59.465Z"}, "users_count"=>22, "vogsphere_id"=>nil}, {"id"=>2, "name"=>"Johannesburg", "time_zone"=>"Africa/Johannesburg", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en", "created_at"=>"2017-11-22T13:40:59.465Z", "updated_at"=>"2017-11-22T13:40:59.465Z"}, "users_count"=>26, "vogsphere_id"=>1}], "skills"=>[], "videos"=>[], "tags"=>[], "project_sessions"=>[{"id"=>7, "solo"=>true, "begin_at"=>nil, "end_at"=>nil, "difficulty"=>5000, "estimate_time"=>2592000, "duration_days"=>nil, "terminating_after"=>nil, "project_id"=>6, "campus_id"=>nil, "cursus_id"=>nil, "created_at"=>"2017-11-22T13:43:54.566Z", "updated_at"=>"2017-11-22T13:43:54.566Z", "max_people"=>nil, "is_subscriptable"=>true, "scales"=>[], "uploads"=>[], "team_behaviour"=>"user", "minimum_mark"=>77}, {"id"=>8, "solo"=>true, "begin_at"=>nil, "end_at"=>nil, "difficulty"=>5000, "estimate_time"=>2592000, "duration_days"=>nil, "terminating_after"=>nil, "project_id"=>6, "campus_id"=>nil, "cursus_id"=>2, "created_at"=>"2017-11-22T13:43:54.574Z", "updated_at"=>"2017-11-22T13:43:54.574Z", "max_people"=>nil, "is_subscriptable"=>true, "scales"=>[], "uploads"=>[], "team_behaviour"=>"user", "minimum_mark"=>77}]}