Crossbell Note
TIP
You can use Crossbell API for free (no rate limit disclosed).
You can initialize with ipfsGateway
to potentially get a faster response or higher stability.
API
Get
const notes: Notes = await unidata.notes.get(options: {
source: 'Crossbell Note';
identity?: string;
platform?: string;
limit?: number;
cursor?: string;
order_by?: "date_created" | "date_updated" | "date_published";
filter?: {
url?: string;
id?: string;
tags?: string[];
}
});
identity
is optional, returns data based on filter only when not provided.- Use Ethereum address as the
identity
and'Ethereum'
as theplatform
to get notes from all profiles belonging to this address. - Use Crossbell handle as the
identity
and'Crossbell'
as theplatform
to get notes from a specific profile. - Use
filter.url
to get notes linking to the url. - Use
filter.url
to get notes with a certain id.
Set
Add, update or remove your notes.
const result: {
code: number;
message: string;
data?: any;
} = await unidata.notes.set(
options: {
source: 'Crossbell Note';
identity: 'Ethereum' | 'Crossbell';
platform?: string;
action?: 'add' | 'remove' | 'update';
},
input: {
id?: string;
related_urls?: string[];
applications?: string[];
tags?: string[];
authors: AccountInstanceURI[];
title?: string;
content_warning?: string;
summary?: {
content?: string;
address?: URI;
mime_type?: string;
size_in_bytes?: number;
};
body?: {
content?: string;
address?: URI;
mime_type?: string;
size_in_bytes?: number;
};
attachments?: {
name?: string;
content?: string;
address?: URI;
mime_type?: string;
size_in_bytes?: number;
}[];
},
extra?: {
targetUri?: string;
targetNote?: string;
newbieToken?: string;
},
);
- Use Ethereum address as the
identity
and'Ethereum'
as theplatform
to set note from primary profile of this address. - Use Crossbell handle as the
identity
and'Crossbell'
as theplatform
to set note from a specific profile. action
: can beadd
,remove
orupdate
, default toadd
.id
:id
is not required foradd
action, but must be included forremove
orupdate
action.targetUri
: post notes to a specific url.targetNote
: post notes to a specific note.newbieToken
: token for Crossbell newbie.
Live Demo
Get
42 / 42
0 / 42
Code
const notes: Notes = await unidata.notes.get({
source: 'Crossbell Note',
identity: '0xC8b960D09C0078c18Dcbe7eB9AB9d816BcCa8944',
platform: 'Ethereum',
limit: 10,
});
View
Data
{}
Set
Open the browser console and execute the following code
add action:
await unidata.notes.set(
{
source: 'Crossbell Note',
identity: '<your_ethereum_address>',
platform: 'Ethereum',
action: 'add',
},
{
title: 'My First Note',
summary: {
content: '> From Unidata',
mime_type: 'text/markdown',
},
body: {
content: 'Body of my first note',
},
attachments: [
{
address: 'ipfs://bafybeifwzi2443622ihqzbs7ed67fed2juhcko35ncyvlngljo6bfjc44e/unidata2.jpeg',
},
],
related_urls: ['https://unidata.app/'],
},
);
remove action:
await unidata.notes.set(
{
source: 'Crossbell Note',
identity: '<your_ethereum_address>',
platform: 'Ethereum',
action: 'remove',
},
{
id: '1',
},
);
update action(TODO):
await unidata.notes.set(
{
source: 'Crossbell Note',
identity: '<your_ethereum_address>',
platform: 'Ethereum',
action: 'update',
},
{
id: '1',
title: 'My Updated First Note',
},
);