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": "The Wings of the Dove",
    "notion_id": "5"
  }
}
201
{
  "id": 21,
  "name": "The Wings of the Dove",
  "slug": "the-wings-of-the-dove",
  "created_at": "2017-03-06T15:20:36.921Z",
  "notepad": null,
  "attachments": [],
  "notion": {
    "id": 5,
    "name": "Piscine OCaml - D02 - Pattern matching & compound types",
    "slug": "piscine-ocaml-d02-pattern-matching-compound-types",
    "created_at": "2017-03-06T14:59:01.649Z"
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"subnotion":{"name":"The Wings of the Dove","notion_id":"5"}}' "https://api.intra.42.fr/v2/subnotions"

{
  "id": 21,
  "name": "The Wings of the Dove",
  "slug": "the-wings-of-the-dove",
  "created_at": "2017-03-06T15:20:36.921Z",
  "notepad": null,
  "attachments": [],
  "notion": {
    "id": 5,
    "name": "Piscine OCaml - D02 - Pattern matching & compound types",
    "slug": "piscine-ocaml-d02-pattern-matching-compound-types",
    "created_at": "2017-03-06T14:59:01.649Z"
  }
}
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: "The Wings of the Dove", notion_id: "5"}}
response = token.post("/v2/subnotions", params: params)
response.status
# => 201
response.parsed
# => {"id"=>21, "name"=>"The Wings of the Dove", "slug"=>"the-wings-of-the-dove", "created_at"=>"2017-03-06T15:20:36.921Z", "notepad"=>nil, "attachments"=>[], "notion"=>{"id"=>5, "name"=>"Piscine OCaml - D02 - Pattern matching & compound types", "slug"=>"piscine-ocaml-d02-pattern-matching-compound-types", "created_at"=>"2017-03-06T14:59:01.649Z"}}