Notizen

Die Notes API ermöglicht das Hinzufügen, Bearbeiten, Abrufen und Archivieren von Notizen

add-note

Notiz hinzufügen

Notizen, die auf diese Weise hinzugefügt werden, können später nicht geändert, abgerufen oder archiviert werden. Für solche Funktionen siehe: Notiz hinzufügen oder aktualisieren mit Referenz-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)

Parameter

Name Beschreibung
node Knoten-ID, DNS-Name oder IP-Adresse

POST-Parameter

Name Beschreibung
subject Notizbetreff
text Notiztext
label leer lassen oder vordefinierte Labels verwenden: 'red', 'green', 'blue', 'yellow'
due Fälligkeitsdatum der Notiz
category Notizkategorie
archived true oder false

Parameter im JSON-Format

{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff verweigert
404 Knoten nicht gefunden

update-or-add-note-using-reference-id

Notiz hinzufügen oder aktualisieren mit Referenz-ID

Diese Methode fügt eine Notiz dem Knoten mit der in der URL übergebenen Referenz-ID hinzu. Die Referenz-ID kann eine beliebige Zeichenfolge oder numerischer Wert sein und wird verwendet, um die Notiz in NetCrunch für weitere Änderungen oder Archivierung zu identifizieren.

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)

Parameter

Name Beschreibung
node Knoten-ID, DNS-Name oder IP-Adresse
refid Notiz-Referenz-ID

PUT-Parameter

Name Beschreibung
subject Notizbetreff
text Notiztext
label leer lassen oder vordefinierte Labels verwenden: 'red', 'green', 'blue', 'yellow'
due Fälligkeitsdatum der Notiz
category Notizkategorie
archived true oder false

Parameter im JSON-Format

{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff verweigert
404 Knoten nicht gefunden

update-or-add-note-property-using-reference-id

Notizeigenschaft hinzufügen oder aktualisieren mit Referenz-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)

Parameter

Name Beschreibung
node Knoten-ID, DNS-Name oder IP-Adresse
refid Notiz-Referenz-ID
property Name der zu ändernden Eigenschaft. Werte: 'subject', 'text', 'label', 'due', 'category', 'archived'

PUT-Parameter

Name Beschreibung
subject Notizbetreff
text Notiztext
label leer lassen oder vordefinierte Labels verwenden: 'red', 'green', 'blue', 'yellow'
due Fälligkeitsdatum der Notiz
category Notizkategorie
archived true oder false

Parameter im JSON-Format

{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff verweigert
404 Knoten nicht gefunden

get-note-by-reference-id

Notiz abrufen mit Referenz-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>')

Parameter

Name Beschreibung
node Knoten-ID, DNS-Name oder IP-Adresse
refid Notiz-Referenz-ID

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff verweigert
404 Knoten oder Notiz nicht gefunden

Ergebnis

{ 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

Notizeigenschaft abrufen mit Referenz-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>')

Parameter

Name Beschreibung
node Knoten-ID, DNS-Name oder IP-Adresse
refid Notiz-Referenz-ID
property Name der zu ändernden Eigenschaft. Werte: 'subject', 'text', 'label', 'due', 'category', 'archived'

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff verweigert
404 Knoten oder Notiz nicht gefunden

Ergebnis

{ subject: "Note subject", archived: false, category: 'Note Category', due: '2020-04-17T15:53:19.773Z', label: 'red', refId: 'myNoteID', text: 'My Note Text' }