POST /v2/notes
Create a note
live_help Notes
This action requires a token resource owner
or an application with one of theses role(s):
assignment_ind
Notes manager
, Advanced notes manager
.
settings Params
Param name | Description |
---|---|
note | optional , nil allowed . Must be a Hash |
note[user_id] |
required
. Must be Fixnum
The user who receives the note. |
note[subject] |
optional
, nil allowed
. Must be String
The subject. |
note[content] |
optional
, nil allowed
. Must be String
The content. |
note[kind] |
optional
, nil allowed
. Must be one of: manual , black_hole , school_record .
The kind. |
note[approved_at] |
optional
, nil allowed
. Must be DateTime
Must be an Advanced Note manager to create or edit this field. |
note[approver_id] |
optional
, nil allowed
. Must be Fixnum
The id of the user approving the note. Must be an Advanced Note manager to create or edit this field. |
Examples
POST /v2/notes
{
"note": {
"content": "gentrify roof beard keffiyeh squid franzen cold-pressed farm-to-table retro fingerstache hoodie health",
"subject": "quinoa",
"user_id": "10"
}
}
201
{
"id": 11,
"from_user": {
"id": 74,
"login": "andre",
"url": "https://api.intra.42.fr/v2/users/andre"
},
"subject": "quinoa",
"content": "gentrify roof beard keffiyeh squid franzen cold-pressed farm-to-table retro fingerstache hoodie health",
"created_at": "2017-11-22T13:43:47.322Z",
"user": {
"id": 10,
"login": "ssebulba",
"url": "https://api.intra.42.fr/v2/users/ssebulba"
}
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"note":{"content":"gentrify roof beard keffiyeh squid franzen cold-pressed farm-to-table retro fingerstache hoodie health","subject":"quinoa","user_id":"10"}}' "https://api.intra.42.fr/v2/notes"
{
"id": 11,
"from_user": {
"id": 74,
"login": "andre",
"url": "https://api.intra.42.fr/v2/users/andre"
},
"subject": "quinoa",
"content": "gentrify roof beard keffiyeh squid franzen cold-pressed farm-to-table retro fingerstache hoodie health",
"created_at": "2017-11-22T13:43:47.322Z",
"user": {
"id": 10,
"login": "ssebulba",
"url": "https://api.intra.42.fr/v2/users/ssebulba"
}
}
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 = {note: {content: "gentrify roof beard keffiyeh squid franzen cold-pressed farm-to-table retro fingerstache hoodie health", subject: "quinoa", user_id: "10"}}
response = token.post("/v2/notes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>11, "from_user"=>{"id"=>74, "login"=>"andre", "url"=>"https://api.intra.42.fr/v2/users/andre"}, "subject"=>"quinoa", "content"=>"gentrify roof beard keffiyeh squid franzen cold-pressed farm-to-table retro fingerstache hoodie health", "created_at"=>"2017-11-22T13:43:47.322Z", "user"=>{"id"=>10, "login"=>"ssebulba", "url"=>"https://api.intra.42.fr/v2/users/ssebulba"}}