Sometimes it is useful to pass additional information to the front-end e.g. a link to a specific product, or some data needed for a button action.
This data can be set via API or manually in the Data
section of a note's Advanced
tab.
Simply include a note.data json array when adding or updating a note.
await pn.update("/products/iphone14", {data: {device_id: 2}});
Parameters are sent in notes.data
as {key:value} pairs, making them easy to access either from an SSR script or on the client-side e.g.:
const search = notes.data.product_id;
pass the find={}
parameter when getting e.g.
https://api.pullnote.com/blog?find={"data.author":"Janet"}
This allows pages to be customised dependent on their path, for example showing the appropriate image:
{#if note.data.city == "London"}
<img src="/i/london-skyline.png" alt="London Skyline" />
{/if}