These examples use the same call as the β‘ API quickstart: a POST of a JSON-RPC tools/call message. Only the tool name and its arguments change. NOTEMAKER_URL and NOTEMAKER_TOKEN are set as in the quickstart. The answer text is in result.content[0].text.
List and search pages
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages","arguments":{"action":"list","limit":20}}}'
Narrow a list with collection_id, parent_id or depth. Search looks in titles and text, every word must match:
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages","arguments":{"action":"search","query":"quarterly plan"}}}'
- Hello from the API (id: cmvp00soi0000qe7dmm9pb073)
Created with curl.
Read a page
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages","arguments":{"action":"get","page_id":"cmvp00soi0000qe7dmm9pb073"}}}'
The body comes back as Markdown, after a short header:
# Hello from the API
- id: cmvp00soi0000qe7dmm9pb073
- workspace: My workspace (your-workspace)
- visibility: private
- width: normal
---
Created with curl.
page_id also accepts a page address or public link.
Create, update and append
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages_write","arguments":{"action":"create","title":"Meeting notes","content_markdown":"## Agenda\n\n- [ ] Review the plan","collection_id":"cmvkjzyjm00047d1u21g2mfct"}}}'
Update replaces the content by default. Use "mode":"append" to add to the end, and leave a field out to keep it as it is:
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages_write","arguments":{"action":"update","page_id":"cmvp00soi0000qe7dmm9pb073","content_markdown":"More text.","mode":"append"}}}'
Updated page cmvp00soi0000qe7dmm9pb073.
Move, share and trash
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages_write","arguments":{"action":"set_visibility","page_id":"cmvp00soi0000qe7dmm9pb073","visibility":"WORKSPACE","level":"VIEW"}}}'
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages_write","arguments":{"action":"delete","page_id":"cmvp00soi0000qe7dmm9pb073"}}}'
Moved page cmvp00soi0000qe7dmm9pb073 to trash.
A deleted page can be brought back with the trash tool, see the Agents, trash and errors examples in this section.
Collections
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"collections","arguments":{"action":"list"}}}'
- Handbook (id: cmvkjzyjm00047d1u21g2mfct, private, 2 pages)
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"collections_write","arguments":{"action":"create","name":"API examples","icon":"π§ͺ"}}}'
Created collection "API examples" (id: cmvp032h60007qe7dx5vtgjbr).
Use a template
curl -s -X POST "$NOTEMAKER_URL" \
-H "Authorization: Bearer $NOTEMAKER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"pages","arguments":{"action":"templates","query":"meeting"}}}'
Then pass the id as template_id to pages_write with "action":"create".