Update user note
Simple HTTP PUT request to Users API and you can update a note within few seconds!
To update a user with JSON type content set header 'content-type: application/json'
PATCH
/users/:id/notes/:note_id/
Parameters
Type
Description
id
integer
Unique ID provided in user model
note_id
integer
Unique ID provided in note model
Attributes
Type
Description
note
string
Content of your note
curl -X PUT -H "Authorization: Token <your_64_char_api_key>" -H "Content-Type: application/json" -d '{
"note": "updated content"
}' "https://<your_app_subdomain>.user.com/api/public/users/:id/notes/note_id/"
Response
{
"id": 27791,
"note": "updated content",
"author": 382
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://<your_app_subdomain>.user.com/api/public/users/:id/notes/note_id/",
"method": "PATCH",
"headers": {
"authorization": "Token <your_64_char_api_key>",
"content-type": "application/json"
},
"processData": false,
"data": "{\n \"note\": \"updated content\" \n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var data = JSON.stringify({
"note": "updated content"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PATCH", "https://<your_app_subdomain>.user.com/api/public/users/:id/notes/note_id/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
var request = require("request");
var options = { method: 'PATCH',
url: 'https://<your_app_subdomain>.user.com/api/public/users/:id/notes/note_id/',
headers:
{ 'content-type': 'application/json',
authorization: 'Token <your_64_char_api_key>' },
body:
{ note: 'updated content' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://<your_app_subdomain>.user.com/api/public/users/:id/notes/note_id/');
$request->setMethod(HTTP_METH_PATCH);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'Token <your_64_char_api_key>'
));
$request->setBody('{
"note": "updated content"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://<your_app_subdomain>.user.com/api/public/users/:id/notes/note_id/"
payload = "{\n \"note\": \"updated content\" \n}"
headers = {
'authorization': "Token <your_64_char_api_key>",
'content-type': "application/json"
}
response = requests.request("PATCH", url, data=payload, headers=headers)
print(response.text)