live_help Notes

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

settings Params

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

The name. Must be unique.

notion[tag_ids] optional , nil allowed . Must be an array of Integer

The tag ids.

notion[cursus_ids] optional , nil allowed . Must be an array of Integer

The cursus ids.

notion[subnotions_attributes] optional , nil allowed . Must be an Array of nested elements

The subnotions attributes.

notion[subnotions_attributes][id] optional , nil allowed . Must be Fixnum

The id.

notion[subnotions_attributes][name] required . Must be String

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

notion[subnotions_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

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

The attachments attributes.

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

The id.

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

The kind.

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

The destroy.

notion[subnotions_attributes][attachments_attributes][language_id] required . Must be Fixnum

The language id.

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

Is it untranslatable ? Default to false.

notion[subnotions_attributes][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/notions
{
  "notion": {
    "cursus_ids": [
      "2"
    ],
    "name": "Legend",
    "subnotions_attributes": [
      {
        "name": "A Glass of Blessings"
      }
    ],
    "tag_ids": [
      "7",
      "9",
      "2"
    ]
  }
}
201
{
  "id": 13,
  "name": "Legend",
  "slug": "legend",
  "created_at": "2017-11-21T17:32:06.481Z",
  "subnotions": [
    {
      "id": 17,
      "name": "A Glass of Blessings",
      "slug": "a-glass-of-blessings",
      "created_at": "2017-11-21T17:32:06.492Z",
      "notepad": null
    }
  ],
  "tags": [
    {
      "id": 7,
      "name": "Bocal",
      "kind": "general"
    },
    {
      "id": 9,
      "name": "Lost and found",
      "kind": "general"
    },
    {
      "id": 2,
      "name": "Friends with Benefits",
      "kind": "project"
    }
  ],
  "cursus": [
    {
      "id": 2,
      "created_at": "2017-11-21T17:08:47.033Z",
      "name": "42",
      "slug": "42"
    }
  ]
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"notion":{"cursus_ids":["2"],"name":"Legend","subnotions_attributes":[{"name":"A Glass of Blessings"}],"tag_ids":["7","9","2"]}}' "https://api.intra.42.fr/v2/notions"

{
  "id": 13,
  "name": "Legend",
  "slug": "legend",
  "created_at": "2017-11-21T17:32:06.481Z",
  "subnotions": [
    {
      "id": 17,
      "name": "A Glass of Blessings",
      "slug": "a-glass-of-blessings",
      "created_at": "2017-11-21T17:32:06.492Z",
      "notepad": null
    }
  ],
  "tags": [
    {
      "id": 7,
      "name": "Bocal",
      "kind": "general"
    },
    {
      "id": 9,
      "name": "Lost and found",
      "kind": "general"
    },
    {
      "id": 2,
      "name": "Friends with Benefits",
      "kind": "project"
    }
  ],
  "cursus": [
    {
      "id": 2,
      "created_at": "2017-11-21T17:08:47.033Z",
      "name": "42",
      "slug": "42"
    }
  ]
}
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 = {notion: {cursus_ids: ["2"], name: "Legend", subnotions_attributes: [{name: "A Glass of Blessings"}], tag_ids: ["7", "9", "2"]}}
response = token.post("/v2/notions", params: params)
response.status
# => 201
response.parsed
# => {"id"=>13, "name"=>"Legend", "slug"=>"legend", "created_at"=>"2017-11-21T17:32:06.481Z", "subnotions"=>[{"id"=>17, "name"=>"A Glass of Blessings", "slug"=>"a-glass-of-blessings", "created_at"=>"2017-11-21T17:32:06.492Z", "notepad"=>nil}], "tags"=>[{"id"=>7, "name"=>"Bocal", "kind"=>"general"}, {"id"=>9, "name"=>"Lost and found", "kind"=>"general"}, {"id"=>2, "name"=>"Friends with Benefits", "kind"=>"project"}], "cursus"=>[{"id"=>2, "created_at"=>"2017-11-21T17:08:47.033Z", "name"=>"42", "slug"=>"42"}]}