Notes
Notes API allows to add, edit, retrieve, and archive notes
add-note
Add Note
Notes added this way can't be later changed, retrieved or archived, for such functionalities, see: Add or update note using reference id
POST /api/rest/2/notes/<node>
cURL
curl --request POST --url "http://localhost/api/rest/2/notes/1001?api_key=<your-api-key>"--header "Content-Type: application/json" --data "{\"subject\": \"Note\ Subject\"}"
Node.js
const http = require('http'), options = { method: 'POST', hostname: 'localhost', path: '/api/rest/2/notes/1001', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, data = { "subject": "Note Subject", "text": "Note Text", "label": "red", "category": "Note Category" }; const req = http.request(options, (res) => { res.setEncoding('utf8');
res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.write(JSON.stringify(data)); req.end();
PowerShell
$url = "http://localhost/api/rest/2/notes/1001" $ata = @{ subject='Note Subject' } $body = (ConvertTo-Json $data) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Post -Body $body -Headers $hdrs
Python
import requests url = 'http://localhost/api/rest/2/notes/1001' data = { "subject": "Note Subject" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.post(url=url, data=data, headers=headers)
Parameters
| Name | Description |
|---|---|
| node | Node ID, DNS name or IP Address |
POST parameters
| Name | Description |
|---|---|
| subject | Note subject |
| text | Note text |
| label | leave empty or use predefined labels: 'red', 'green', 'blue', 'yellow' |
| due | Note due date |
| category | Note category |
| archived | true or false |
Parameters in JSON format
{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Access denied |
| 404 | Node not found |
update-or-add-note-using-reference-id
Add or update note by using reference ID
This method will add a note to the node with reference id - passed in the URL. Reference ID can be any string or numeric value, and it's used to identify note in NetCrunch for further modification or archivization of the note
PUT /api/rest/2/notes/<node>/<refId>
cURL
curl --request put--url "http://localhost/api/rest/2/notes/1001/myNoteID?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"subject\": \"Note\ Subject\"}"
Node.js
const http = require('http'), options = { method: 'put', hostname: 'localhost', path: '/api/rest/2/notes/1001/myNoteID', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, data = { "subject": "Note Subject", "text": "Note Text", "label": "red", "category": "Note Category" };const req = http.request(options, (res) => { res.setEncoding('utf8');
res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.write(JSON.stringify(data)); req.end();
PowerShell
$url = "http://localhost/api/rest/2/notes/1001/myNoteID" $data = @{ subject='Note Subject' } $body = (ConvertTo-Json $data) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method put-Body $body -Headers $hdrs
Python
import requests url = 'http://localhost/api/rest/2/notes/1001/myNoteID' data = { "subject": "Note Subject" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url=url, data=data, headers=headers)
Parameters
| Name | Description |
|---|---|
| node | Node ID, DNS name or IP Address |
| refid | Note reference ID |
PUT parameters
| Name | Description |
|---|---|
| subject | Note subject |
| text | Note text |
| label | leave empty or use predefined labels: 'red', 'green', 'blue', 'yellow' |
| due | Note due date |
| category | Note category |
| archived | true or false |
Parameters in JSON format
{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Access denied |
| 404 | Node not found |
update-or-add-note-property-using-reference-id
Add or Update note property by using reference ID
PUT /api/rest/2/notes/<node>/<refId>/<property>
cURL
curl --request PUT--url "http://localhost/api/rest/2/notes/1001/myNoteID/subject?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"value\": \"New\ Subject\"}"
Node.js
const http = require('http'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/notes/1001/myNoteID/subject', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, data = { "value": "New Subject" };const req = http.request(options, (res) => { res.setEncoding('utf8');
res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.write(JSON.stringify(data)); req.end();
PowerShell
$url = "http://localhost/api/rest/2/notes/1001/myNoteID/subject" $data = @{ value='New Subject' } $body = (ConvertTo-Json $data) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method put-Body $body -Headers $hdrs
Python
import requests url = 'http://localhost/api/rest/2/notes/1001/myNoteID/subject' data = { "value": "New Subject" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.post(url=url, data=data, headers=headers)
Parameters
| Name | Description |
|---|---|
| node | Node ID, DNS name or IP Address |
| refid | Note reference ID |
| property | Name of property to change. Values: 'subject', 'text', 'label', 'due', 'category', 'archived' |
PUT parameters
| Name | Description |
|---|---|
| subject | Note subject |
| text | Note text |
| label | leave empty or use predefined labels: 'red', 'green', 'blue', 'yellow' |
| due | Note due date |
| category | Note category |
| archived | true or false |
Parameters in JSON format
{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Access denied |
| 404 | Node not found |
get-note-by-reference-id
Get note by reference ID
GET GET /api/rest/2/notes/<node>/<refId>
cURL
curl --url "http://localhost/api/rest/2/notes/1001/myNoteID?api_key=<your-api-key>"
Node.js
const http = require('http');http.get('http://localhost/api/rest/2/notes/1001/myNoteID?api_key=<your-api-key>', (res) => { res.setEncoding('utf8');
res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });
PowerShell
Invoke-RestMethod -Uri "http://localhost/api/rest/2/notes/1001/myNoteID?api_key=<your-api-key>"
Python
import requests requests.get('http://localhost/api/rest/2/notes/1001/myNoteID?api_key=<your-api-key>')
Parameters
| Name | Description |
|---|---|
| node | Node ID, DNS name or IP Address |
| refid | Note reference ID |
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Access denied |
| 404 | Node or note not found |
Result
{ subject: "Note subject", archived: false, category: 'Note Category', due: '2020-04-17T15:53:19.773Z', label: 'red', refId: 'myNoteID', text: 'My Note Text' }
get-note-property-by-reference-id
Get note property by reference ID
GET /api/rest/2/notes/<node>/<refId>/<property>
cURL
curl --url "http://localhost/api/rest/2/notes/1001/myNoteID/subject?api_key=<your-api-key>"
Node.js
const http = require('http');http.get('http://localhost/api/rest/2/notes/1001/myNoteID/subject?api_key=<your-api-key>', (res) => { res.setEncoding('utf8');
res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });
PowerShell
Invoke-RestMethod -Uri "http://localhost/api/rest/2/notes/1001/myNoteID/subject?api_key=<your-api-key>"
Python
import requests requests.get('http://localhost/api/rest/2/notes/1001/myNoteID/subject?api_key=<your-api-key>')
Parameters
| Name | Description |
|---|---|
| node | Node ID, DNS name or IP Address |
| refid | Note reference ID |
| property | Name of property to change. Values: 'subject', 'text', 'label', 'due', 'category', 'archived' |
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Access denied |
| 404 | Node or note not found |
Result
{ subject: "Note subject", archived: false, category: 'Note Category', due: '2020-04-17T15:53:19.773Z', label: 'red', refId: 'myNoteID', text: 'My Note Text' }