Notatki
Notes API umożliwia dodawanie, edycję, pobieranie i archiwizację notatek
add-note
Dodaj notatkę
Notatki dodane w ten sposób nie mogą być później zmieniane, pobierane ani archiwizowane. W celu uzyskania takich funkcji, zobacz: Dodaj lub zaktualizuj notatkę używając identyfikatora referencyjnego
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" $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 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)
Parametry
| Name | Description |
|---|---|
| node | ID węzła, nazwa DNS lub adres IP |
Parametry POST
| Name | Description |
|---|---|
| subject | Temat notatki |
| text | Treść notatki |
| label | pozostaw puste lub użyj zdefiniowanych etykiet: 'red', 'green', 'blue', 'yellow' |
| due | Termin notatki |
| category | Kategoria notatki |
| archived | true lub false |
Parametry w formacie JSON
{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }
Kody statusu
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Odmowa dostępu |
| 404 | Węzeł nie znaleziony |
update-or-add-note-using-reference-id
Dodaj lub zaktualizuj notatkę używając identyfikatora referencyjnego
Ta metoda doda notatkę do węzła z identyfikatorem referencyjnym - przekazanym w URL. Identyfikator referencyjny może być dowolną wartością numeryczną lub tekstową i służy do identyfikacji notatki w NetCrunch w celu dalszej modyfikacji lub archiwizacji notatki
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)
Parametry
| Name | Description |
|---|---|
| node | ID węzła, nazwa DNS lub adres IP |
| refid | Identyfikator referencyjny notatki |
Parametry PUT
| Name | Description |
|---|---|
| subject | Temat notatki |
| text | Treść notatki |
| label | pozostaw puste lub użyj zdefiniowanych etykiet: 'red', 'green', 'blue', 'yellow' |
| due | Termin notatki |
| category | Kategoria notatki |
| archived | true lub false |
Parametry w formacie JSON
{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }
Kody statusu
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Odmowa dostępu |
| 404 | Węzeł nie znaleziony |
update-or-add-note-property-using-reference-id
Dodaj lub zaktualizuj właściwość notatki używając identyfikatora referencyjnego
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)
Parametry
| Name | Description |
|---|---|
| node | ID węzła, nazwa DNS lub adres IP |
| refid | Identyfikator referencyjny notatki |
| property | Nazwa właściwości do zmiany. Wartości: 'subject', 'text', 'label', 'due', 'category', 'archived' |
Parametry PUT
| Name | Description |
|---|---|
| subject | Temat notatki |
| text | Treść notatki |
| label | pozostaw puste lub użyj zdefiniowanych etykiet: 'red', 'green', 'blue', 'yellow' |
| due | Termin notatki |
| category | Kategoria notatki |
| archived | true lub false |
Parametry w formacie JSON
{ "subject": "Note Subject", "text": "Note Text", "label": "red", "due": "2020-01-10T18:02:36.017Z", "category": "My Category", "archived": false }
Kody statusu
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Odmowa dostępu |
| 404 | Węzeł nie znaleziony |
get-note-by-reference-id
Pobierz notatkę używając identyfikatora referencyjnego
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>')
Parametry
| Name | Description |
|---|---|
| node | ID węzła, nazwa DNS lub adres IP |
| refid | Identyfikator referencyjny notatki |
Kody statusu
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Odmowa dostępu |
| 404 | Węzeł lub notatka nie znalezione |
Wynik
{ 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
Pobierz właściwość notatki używając identyfikatora referencyjnego
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>')
Parametry
| Name | Description |
|---|---|
| node | ID węzła, nazwa DNS lub adres IP |
| refid | Identyfikator referencyjny notatki |
| property | Nazwa właściwości do zmiany. Wartości: 'subject', 'text', 'label', 'due', 'category', 'archived' |
Kody statusu
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Odmowa dostępu |
| 404 | Węzeł lub notatka nie znalezione |
Wynik
{ subject: "Note subject", archived: false, category: 'Note Category', due: '2020-04-17T15:53:19.773Z', label: 'red', refId: 'myNoteID', text: 'My Note Text' }