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": "New Hampshire dogs",
    "skill_ids": [
      "27",
      "28"
    ]
  }
}
201
{
  "id": 4,
  "created_at": "2017-03-06T15:20:10.837Z",
  "name": "New Hampshire dogs",
  "slug": "new-hampshire-dogs"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"cursus":{"name":"New Hampshire dogs","skill_ids":["27","28"]}}' "https://api.intra.42.fr/v2/cursus"

{
  "id": 4,
  "created_at": "2017-03-06T15:20:10.837Z",
  "name": "New Hampshire dogs",
  "slug": "new-hampshire-dogs"
}
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: "New Hampshire dogs", skill_ids: ["27", "28"]}}
response = token.post("/v2/cursus", params: params)
response.status
# => 201
response.parsed
# => {"id"=>4, "created_at"=>"2017-03-06T15:20:10.837Z", "name"=>"New Hampshire dogs", "slug"=>"new-hampshire-dogs"}