live_help Notes

assignment This action requires one of theses roles: Advanced tutor
group_work Requires following application scopes: projects

settings Params

Param name Description
project_session optional , nil allowed . Must be a Hash
project_session[id] optional , nil allowed . Must be Fixnum

The id.

project_session[campus_id] optional , nil allowed . Must be Fixnum

The campus id.

project_session[project_id] required . Must be Fixnum

The project id. Must be unique in the scope of a given cursus id and campus.

project_session[cursus_id] optional , nil allowed . Must be Fixnum

The cursus id.

project_session[estimate_time] optional , nil allowed . Must be Fixnum

The estimate time.

project_session[created_at] optional , nil allowed . Must be DateTime

The created at.

project_session[updated_at] optional , nil allowed . Must be DateTime

The updated at.

project_session[begin_at] optional , nil allowed . Must be DateTime

The begin at.

project_session[end_at] optional , nil allowed . Must be DateTime

The end at.

project_session[max_people] optional , nil allowed . Must be Fixnum

The max people.

project_session[duration_days] optional , nil allowed . Must be Fixnum

The duration days.

project_session[terminating_after] optional , nil allowed . Must be Fixnum

The terminating after.

project_session[solo] optional , nil allowed . Must be one of: true, false.

Is it solo ? Default to false.

project_session[is_subscriptable] optional , nil allowed . Must be one of: true, false.

Is it is subscriptable ? Default to true.

project_session[minimum_mark] required . Must be Fixnum

The minimum mark.

project_session[team_behaviour] required . Must be one of: user, upload, by_rule, none.

The team behaviour.

project_session[evaluations_attributes] optional , nil allowed . Must be an Array of nested elements

The evaluations attributes.

project_session[evaluations_attributes][id] optional , nil allowed . Must be Fixnum

The id.

project_session[evaluations_attributes][kind] optional , nil allowed . Must be one of: scale, upload.

The kind.

project_session[evaluations_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

project_session[evaluations_project_sessions_attributes] optional , nil allowed . Must be an Array of nested elements

The evaluations project sessions attributes.

project_session[evaluations_project_sessions_attributes][evaluation_id] required . Must be Fixnum

The evaluation id.

project_session[evaluations_project_sessions_attributes][project_session_id] optional , nil allowed . Must be Fixnum

The project session id.

project_session[evaluations_project_sessions_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

project_session[evaluations_project_sessions_attributes][id] optional , nil allowed . Must be Fixnum

The id.

project_session[project_sessions_rules_attributes] optional , nil allowed . Must be an Array of nested elements

The project sessions rules attributes.

project_session[project_sessions_rules_attributes][id] optional , nil allowed . Must be Fixnum

The id.

project_session[project_sessions_rules_attributes][rule_id] required . Must be Fixnum

The rule id.

project_session[project_sessions_rules_attributes][required] optional , nil allowed . Must be one of: true, false.

Is it required ?

project_session[project_sessions_rules_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

project_session[project_sessions_rules_attributes][params_project_sessions_rules_attributes] optional , nil allowed . Must be an Array of nested elements

The params project sessions rules attributes.

project_session[project_sessions_rules_attributes][params_project_sessions_rules_attributes][id] optional , nil allowed . Must be Fixnum

The id.

project_session[project_sessions_rules_attributes][params_project_sessions_rules_attributes][param_id] optional , nil allowed . Must be Fixnum

The param id.

project_session[project_sessions_rules_attributes][params_project_sessions_rules_attributes][value] optional , nil allowed . Must be String

The value.

project_session[project_sessions_rules_attributes][params_project_sessions_rules_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/project_sessions
{
  "project_session": {
    "campus_id": "2",
    "cursus_id": "2",
    "estimate_time": "2592000",
    "is_subscriptable": "true",
    "minimum_mark": "77",
    "project_id": "5",
    "solo": "true",
    "team_behaviour": "user"
  }
}
201
{
  "id": 18,
  "solo": true,
  "begin_at": null,
  "end_at": null,
  "estimate_time": 2592000,
  "duration_days": null,
  "terminating_after": null,
  "project_id": 5,
  "campus_id": 2,
  "cursus_id": 2,
  "created_at": "2017-03-06T15:20:26.842Z",
  "updated_at": "2017-03-06T15:20:26.842Z",
  "max_people": null,
  "is_subscriptable": true,
  "scales": [],
  "uploads": [],
  "team_behaviour": "user",
  "minimum_mark": 77,
  "project": {
    "id": 5,
    "name": "Quarter Finals",
    "slug": "hogwarts-quidditch-cup-quarter-finals",
    "description": null,
    "parent": {
      "name": "Hogwarts Quidditch Cup",
      "id": 4,
      "slug": "hogwarts-quidditch-cup",
      "url": "https://projects.intra.42.fr/hogwarts-quidditch-cup/mine"
    },
    "children": [],
    "objectives": null,
    "tier": null,
    "attachments": [],
    "created_at": "2017-03-06T14:59:05.006Z",
    "updated_at": "2017-03-06T15:20:26.846Z",
    "exam": false
  },
  "campus": {
    "id": 2,
    "name": "Johannesburg",
    "time_zone": "Pretoria",
    "language": {
      "id": 2,
      "name": "English",
      "identifier": "en",
      "created_at": "2017-03-06T14:58:43.172Z",
      "updated_at": "2017-03-06T14:58:43.172Z"
    },
    "users_count": 13,
    "vogsphere_id": 1
  },
  "cursus": {
    "id": 2,
    "created_at": "2017-03-06T14:58:44.047Z",
    "name": "42",
    "slug": "42"
  },
  "evaluations": [],
  "project_sessions_rules": []
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"project_session":{"campus_id":"2","cursus_id":"2","estimate_time":"2592000","is_subscriptable":"true","minimum_mark":"77","project_id":"5","solo":"true","team_behaviour":"user"}}' "https://api.intra.42.fr/v2/project_sessions"

{
  "id": 18,
  "solo": true,
  "begin_at": null,
  "end_at": null,
  "estimate_time": 2592000,
  "duration_days": null,
  "terminating_after": null,
  "project_id": 5,
  "campus_id": 2,
  "cursus_id": 2,
  "created_at": "2017-03-06T15:20:26.842Z",
  "updated_at": "2017-03-06T15:20:26.842Z",
  "max_people": null,
  "is_subscriptable": true,
  "scales": [],
  "uploads": [],
  "team_behaviour": "user",
  "minimum_mark": 77,
  "project": {
    "id": 5,
    "name": "Quarter Finals",
    "slug": "hogwarts-quidditch-cup-quarter-finals",
    "description": null,
    "parent": {
      "name": "Hogwarts Quidditch Cup",
      "id": 4,
      "slug": "hogwarts-quidditch-cup",
      "url": "https://projects.intra.42.fr/hogwarts-quidditch-cup/mine"
    },
    "children": [],
    "objectives": null,
    "tier": null,
    "attachments": [],
    "created_at": "2017-03-06T14:59:05.006Z",
    "updated_at": "2017-03-06T15:20:26.846Z",
    "exam": false
  },
  "campus": {
    "id": 2,
    "name": "Johannesburg",
    "time_zone": "Pretoria",
    "language": {
      "id": 2,
      "name": "English",
      "identifier": "en",
      "created_at": "2017-03-06T14:58:43.172Z",
      "updated_at": "2017-03-06T14:58:43.172Z"
    },
    "users_count": 13,
    "vogsphere_id": 1
  },
  "cursus": {
    "id": 2,
    "created_at": "2017-03-06T14:58:44.047Z",
    "name": "42",
    "slug": "42"
  },
  "evaluations": [],
  "project_sessions_rules": []
}
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_session: {campus_id: "2", cursus_id: "2", estimate_time: "2592000", is_subscriptable: "true", minimum_mark: "77", project_id: "5", solo: "true", team_behaviour: "user"}}
response = token.post("/v2/project_sessions", params: params)
response.status
# => 201
response.parsed
# => {"id"=>18, "solo"=>true, "begin_at"=>nil, "end_at"=>nil, "estimate_time"=>2592000, "duration_days"=>nil, "terminating_after"=>nil, "project_id"=>5, "campus_id"=>2, "cursus_id"=>2, "created_at"=>"2017-03-06T15:20:26.842Z", "updated_at"=>"2017-03-06T15:20:26.842Z", "max_people"=>nil, "is_subscriptable"=>true, "scales"=>[], "uploads"=>[], "team_behaviour"=>"user", "minimum_mark"=>77, "project"=>{"id"=>5, "name"=>"Quarter Finals", "slug"=>"hogwarts-quidditch-cup-quarter-finals", "description"=>nil, "parent"=>{"name"=>"Hogwarts Quidditch Cup", "id"=>4, "slug"=>"hogwarts-quidditch-cup", "url"=>"https://projects.intra.42.fr/hogwarts-quidditch-cup/mine"}, "children"=>[], "objectives"=>nil, "tier"=>nil, "attachments"=>[], "created_at"=>"2017-03-06T14:59:05.006Z", "updated_at"=>"2017-03-06T15:20:26.846Z", "exam"=>false}, "campus"=>{"id"=>2, "name"=>"Johannesburg", "time_zone"=>"Pretoria", "language"=>{"id"=>2, "name"=>"English", "identifier"=>"en", "created_at"=>"2017-03-06T14:58:43.172Z", "updated_at"=>"2017-03-06T14:58:43.172Z"}, "users_count"=>13, "vogsphere_id"=>1}, "cursus"=>{"id"=>2, "created_at"=>"2017-03-06T14:58:44.047Z", "name"=>"42", "slug"=>"42"}, "evaluations"=>[], "project_sessions_rules"=>[]}