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": "By Grand Central Station I Sat Down and Wept",
    "notion_id": "1"
  }
}
201
{
  "id": 15,
  "name": "By Grand Central Station I Sat Down and Wept",
  "slug": "by-grand-central-station-i-sat-down-and-wept",
  "created_at": "2017-11-22T13:44:04.723Z",
  "notepad": null,
  "attachments": [],
  "notion": {
    "id": 1,
    "name": "42run Demo",
    "slug": "42run-demo",
    "created_at": "2017-11-22T13:41:23.730Z"
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"subnotion":{"name":"By Grand Central Station I Sat Down and Wept","notion_id":"1"}}' "https://api.intra.42.fr/v2/subnotions"

{
  "id": 15,
  "name": "By Grand Central Station I Sat Down and Wept",
  "slug": "by-grand-central-station-i-sat-down-and-wept",
  "created_at": "2017-11-22T13:44:04.723Z",
  "notepad": null,
  "attachments": [],
  "notion": {
    "id": 1,
    "name": "42run Demo",
    "slug": "42run-demo",
    "created_at": "2017-11-22T13:41:23.730Z"
  }
}
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: "By Grand Central Station I Sat Down and Wept", notion_id: "1"}}
response = token.post("/v2/subnotions", params: params)
response.status
# => 201
response.parsed
# => {"id"=>15, "name"=>"By Grand Central Station I Sat Down and Wept", "slug"=>"by-grand-central-station-i-sat-down-and-wept", "created_at"=>"2017-11-22T13:44:04.723Z", "notepad"=>nil, "attachments"=>[], "notion"=>{"id"=>1, "name"=>"42run Demo", "slug"=>"42run-demo", "created_at"=>"2017-11-22T13:41:23.730Z"}}