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": "4",
    "cursus_id": "1",
    "estimate_time": "2592000",
    "is_subscriptable": "true",
    "minimum_mark": "77",
    "project_id": "1",
    "solo": "true",
    "team_behaviour": "user"
  }
}
201
{
  "id": 6,
  "solo": true,
  "begin_at": null,
  "end_at": null,
  "estimate_time": 2592000,
  "duration_days": null,
  "terminating_after": null,
  "project_id": 1,
  "campus_id": 4,
  "cursus_id": 1,
  "created_at": "2017-11-22T13:43:53.741Z",
  "updated_at": "2017-11-22T13:43:53.741Z",
  "max_people": null,
  "is_subscriptable": true,
  "scales": [],
  "uploads": [],
  "team_behaviour": "user",
  "minimum_mark": 77,
  "project": {
    "id": 1,
    "name": "Libft",
    "slug": "libft",
    "description": "The first project of 42 !",
    "parent": null,
    "children": [],
    "objectives": [
      "initiation"
    ],
    "tier": 1,
    "attachments": [
      {
        "id": 1,
        "name": "New Jersey zombies",
        "pdf": {
          "pdf": {
            "url": null,
            "thumb": {
              "url": null
            }
          }
        },
        "page_count": 1,
        "created_at": "2017-11-22T13:41:25.981Z",
        "pdf_processing": true,
        "slug": "new-jersey-zombies",
        "url": null,
        "thumb_url": null,
        "base_id": 1,
        "language": {
          "id": 3,
          "name": "Romanian",
          "identifier": "ro"
        },
        "type": "Pdf"
      }
    ],
    "created_at": "2017-11-22T13:41:25.963Z",
    "updated_at": "2017-11-22T13:43:53.749Z",
    "exam": false
  },
  "campus": {
    "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
  },
  "cursus": {
    "id": 1,
    "created_at": "2017-11-22T13:41:00.750Z",
    "name": "Piscine C",
    "slug": "piscine-c"
  },
  "evaluations": [],
  "project_sessions_rules": []
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"project_session":{"campus_id":"4","cursus_id":"1","estimate_time":"2592000","is_subscriptable":"true","minimum_mark":"77","project_id":"1","solo":"true","team_behaviour":"user"}}' "https://api.intra.42.fr/v2/project_sessions"

{
  "id": 6,
  "solo": true,
  "begin_at": null,
  "end_at": null,
  "estimate_time": 2592000,
  "duration_days": null,
  "terminating_after": null,
  "project_id": 1,
  "campus_id": 4,
  "cursus_id": 1,
  "created_at": "2017-11-22T13:43:53.741Z",
  "updated_at": "2017-11-22T13:43:53.741Z",
  "max_people": null,
  "is_subscriptable": true,
  "scales": [],
  "uploads": [],
  "team_behaviour": "user",
  "minimum_mark": 77,
  "project": {
    "id": 1,
    "name": "Libft",
    "slug": "libft",
    "description": "The first project of 42 !",
    "parent": null,
    "children": [],
    "objectives": [
      "initiation"
    ],
    "tier": 1,
    "attachments": [
      {
        "id": 1,
        "name": "New Jersey zombies",
        "pdf": {
          "pdf": {
            "url": null,
            "thumb": {
              "url": null
            }
          }
        },
        "page_count": 1,
        "created_at": "2017-11-22T13:41:25.981Z",
        "pdf_processing": true,
        "slug": "new-jersey-zombies",
        "url": null,
        "thumb_url": null,
        "base_id": 1,
        "language": {
          "id": 3,
          "name": "Romanian",
          "identifier": "ro"
        },
        "type": "Pdf"
      }
    ],
    "created_at": "2017-11-22T13:41:25.963Z",
    "updated_at": "2017-11-22T13:43:53.749Z",
    "exam": false
  },
  "campus": {
    "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
  },
  "cursus": {
    "id": 1,
    "created_at": "2017-11-22T13:41:00.750Z",
    "name": "Piscine C",
    "slug": "piscine-c"
  },
  "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: "4", cursus_id: "1", estimate_time: "2592000", is_subscriptable: "true", minimum_mark: "77", project_id: "1", solo: "true", team_behaviour: "user"}}
response = token.post("/v2/project_sessions", params: params)
response.status
# => 201
response.parsed
# => {"id"=>6, "solo"=>true, "begin_at"=>nil, "end_at"=>nil, "estimate_time"=>2592000, "duration_days"=>nil, "terminating_after"=>nil, "project_id"=>1, "campus_id"=>4, "cursus_id"=>1, "created_at"=>"2017-11-22T13:43:53.741Z", "updated_at"=>"2017-11-22T13:43:53.741Z", "max_people"=>nil, "is_subscriptable"=>true, "scales"=>[], "uploads"=>[], "team_behaviour"=>"user", "minimum_mark"=>77, "project"=>{"id"=>1, "name"=>"Libft", "slug"=>"libft", "description"=>"The first project of 42 !", "parent"=>nil, "children"=>[], "objectives"=>["initiation"], "tier"=>1, "attachments"=>[{"id"=>1, "name"=>"New Jersey zombies", "pdf"=>{"pdf"=>{"url"=>nil, "thumb"=>{"url"=>nil}}}, "page_count"=>1, "created_at"=>"2017-11-22T13:41:25.981Z", "pdf_processing"=>true, "slug"=>"new-jersey-zombies", "url"=>nil, "thumb_url"=>nil, "base_id"=>1, "language"=>{"id"=>3, "name"=>"Romanian", "identifier"=>"ro"}, "type"=>"Pdf"}], "created_at"=>"2017-11-22T13:41:25.963Z", "updated_at"=>"2017-11-22T13:43:53.749Z", "exam"=>false}, "campus"=>{"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}, "cursus"=>{"id"=>1, "created_at"=>"2017-11-22T13:41:00.750Z", "name"=>"Piscine C", "slug"=>"piscine-c"}, "evaluations"=>[], "project_sessions_rules"=>[]}