Notes

Notes APIを使用すると、メモを追加、編集、取得、アーカイブできます

add-note

Noteの追加

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, data=data, headers=headers)

パラメータ

Name 説明
node Node ID, DNS name or IP Address

POST パラメータ

Name 説明
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

JSON形式のパラメータ

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

*ステータスコード

ステータスコード 説明
200 OK
401 Access denied
404 Node not found

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

reference IDを使用してメモを追加または更新する

このメソッドは、reference IDを持つノードにnoteを追加します - URLでユーザーが設定します。 reference IDは任意の文字列または数値にすることができ、noteをさらに変更またはアーカイブするためにNetCrunchで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, data=data, headers=headers)

パラメータ

Name 説明
node Node ID, DNS name or IP Address
refid Note reference ID

PUTパラメータ

Name 説明
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

JSON形式のパラメータ

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

ステータスコード

ステータスコード 説明
200 OK
401 Access denied
404 Node not found

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

reference IDを使用してnoteプロパティを追加または更新する

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, data=data, headers=headers)

パラメータ

Name 説明
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 パラメータ

Name 説明
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

JSON形式のパラメータ

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

ステータスコード

ステータスコード 説明
200 OK
401 Access denied
404 Node not found

get-note-by-reference-id

reference IDでnoteを取得する

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>')

パラメータ

Name 説明
node Node ID, DNS name or IP Address
refid Note reference ID

ステータスコード

Status Code 説明
200 OK
401 Access denied
404 Node or note not found

結果

{ 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

reference IDでnoteプロパティを取得する

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>')

パラメータ

Name 説明
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'

ステータスコード

ステータスコード 説明
200 OK
401 Access denied
404 Node or note not found

結果

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