live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
cursus optional , nil allowed . Must be a Hash
cursus[name] required . Must be String

The name. Must be unique.

cursus[kind] optional , nil allowed . Must be one of: normal, piscine, external.

The kind.

cursus[skill_ids] optional , nil allowed . Must be an array of Integer

The skill ids.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/cursus
{
  "cursus": {
    "name": "Oregon tigers",
    "skill_ids": [
      "11",
      "12"
    ]
  }
}
201
{
  "id": 3,
  "created_at": "2017-11-22T13:43:33.469Z",
  "name": "Oregon tigers",
  "slug": "oregon-tigers"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"cursus":{"name":"Oregon tigers","skill_ids":["11","12"]}}' "https://api.intra.42.fr/v2/cursus"

{
  "id": 3,
  "created_at": "2017-11-22T13:43:33.469Z",
  "name": "Oregon tigers",
  "slug": "oregon-tigers"
}
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 = {cursus: {name: "Oregon tigers", skill_ids: ["11", "12"]}}
response = token.post("/v2/cursus", params: params)
response.status
# => 201
response.parsed
# => {"id"=>3, "created_at"=>"2017-11-22T13:43:33.469Z", "name"=>"Oregon tigers", "slug"=>"oregon-tigers"}