live_help Notes

assignment This action requires one of theses roles: Advanced tutor, Video manager

settings Params

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

The id.

subnotion[name] required . Must be String

The name. Must be unique in the scope of a given notion.

subnotion[notion_id] optional , nil allowed . Must be Fixnum

The notion id.

subnotion[attachments_attributes] optional , nil allowed . Must be an Array of nested elements

The attachments attributes.

subnotion[attachments_attributes][id] optional , nil allowed . Must be Fixnum

The id.

subnotion[attachments_attributes][kind] optional , nil allowed . Must be one of: code, pdf, link, document, video.

The kind.

subnotion[attachments_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

subnotion[attachments_attributes][language_id] required . Must be Fixnum

The language id.

subnotion[attachments_attributes][untranslatable] optional , nil allowed . Must be one of: true, false.

Is it untranslatable ? Default to false.

subnotion[attachments_attributes][attachable_attributes] optional , nil allowed . Must be an Array of nested elements

The attachable attributes.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/subnotions
{
  "subnotion": {
    "name": "To Sail Beyond the Sunset",
    "notion_id": "4"
  }
}
201
{
  "id": 21,
  "name": "To Sail Beyond the Sunset",
  "slug": "to-sail-beyond-the-sunset",
  "created_at": "2017-11-21T17:32:22.885Z",
  "notepad": null,
  "attachments": [],
  "notion": {
    "id": 4,
    "name": "Piscine Unity - D01 - 2D physics and scenes",
    "slug": "piscine-unity-d01-2d-physics-and-scenes",
    "created_at": "2017-11-21T17:09:10.534Z"
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"subnotion":{"name":"To Sail Beyond the Sunset","notion_id":"4"}}' "https://api.intra.42.fr/v2/subnotions"

{
  "id": 21,
  "name": "To Sail Beyond the Sunset",
  "slug": "to-sail-beyond-the-sunset",
  "created_at": "2017-11-21T17:32:22.885Z",
  "notepad": null,
  "attachments": [],
  "notion": {
    "id": 4,
    "name": "Piscine Unity - D01 - 2D physics and scenes",
    "slug": "piscine-unity-d01-2d-physics-and-scenes",
    "created_at": "2017-11-21T17:09:10.534Z"
  }
}
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 = {subnotion: {name: "To Sail Beyond the Sunset", notion_id: "4"}}
response = token.post("/v2/subnotions", params: params)
response.status
# => 201
response.parsed
# => {"id"=>21, "name"=>"To Sail Beyond the Sunset", "slug"=>"to-sail-beyond-the-sunset", "created_at"=>"2017-11-21T17:32:22.885Z", "notepad"=>nil, "attachments"=>[], "notion"=>{"id"=>4, "name"=>"Piscine Unity - D01 - 2D physics and scenes", "slug"=>"piscine-unity-d01-2d-physics-and-scenes", "created_at"=>"2017-11-21T17:09:10.534Z"}}