PATCH /v2/notions/:id
Update a notion
PUT /v2/notions/:id
Update a notion
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
, Video manager
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
notion | optional , nil allowed . Must be a Hash |
notion[name] |
optional
. 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] |
optional
. 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] |
optional
. 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. |
Examples
PUT /v2/notions/3
{
"notion": {
"cursus_ids": [
"2"
],
"name": "Metafiction",
"subnotions_attributes": [
{
"name": "The Millstone"
}
],
"tag_ids": [
"1",
"11",
"10"
]
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"notion":{"cursus_ids":["2"],"name":"Metafiction","subnotions_attributes":[{"name":"The Millstone"}],"tag_ids":["1","11","10"]}}' "https://api.intra.42.fr/v2/notions/3"
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: "Metafiction", subnotions_attributes: [{name: "The Millstone"}], tag_ids: ["1", "11", "10"]}}
response = token.put("/v2/notions/3", params: params)
response.status
# => 204
response.parsed
# =>