Invite Who can see a board, and adding somebody to it.
Lists the people invited to a board. Owner only.
Name Type Required Description boardIdinteger yes The board.
cURL JavaScript Vue React PHP
curl -X GET "https://boards.example.com/api/data/invite?boardId=123" \
-H "X-API-Key: $LOKALBOARDS_KEY "
const response = await fetch ( "https://boards.example.com/api/data/invite?boardId=123" , {
headers: {
"X-API-Key" : apiKey,
},
});
if ( ! response.ok) throw new Error ( await response. text ());
const data = await response. json ();
< script setup >
const config = useRuntimeConfig ();
const { data , error } = await useAsyncData ( "invite" , () =>
$fetch ( "https://boards.example.com/api/data/invite?boardId=123" , {
headers: { "X-API-Key" : config.lokalBoardsKey },
}),
);
</ script >
< template >
< pre v-if = "data" >{{ data }}</ pre >
< p v-else-if = "error" >{{ error.message }}</ p >
</ template >
import { useEffect, useState } from "react" ;
export function Example ({ apiKey }) {
const [ data , setData ] = useState ( null );
useEffect (() => {
const controller = new AbortController ();
fetch ( "https://boards.example.com/api/data/invite?boardId=123" , {
headers: { "X-API-Key" : apiKey },
signal: controller.signal,
})
. then (( response ) => response. json ())
. then (setData)
. catch (( error ) => {
if (error.name !== "AbortError" ) console. error (error);
});
return () => controller. abort ();
}, [apiKey]);
return < pre >{ JSON . stringify (data, null , 2 )}</ pre >;
}
<?php
$ch = curl_init('https://boards.example.com/api/data/invite?boardId=123');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Gives somebody access to a board. Owner only.
Identify them either by userId, for an account that already exists here, or by
mail. An address with no account is sent an invitation link that creates the
account and joins them to this board — see Boards .
Name Type Required Description boardIdinteger yes The board to share. userIdstring one of An existing account's id. mailstring one of An e-mail address. permissionstring yes read or edit.
cURL JavaScript Vue React PHP
curl -X POST "https://boards.example.com/api/data/invite" \
-H "X-API-Key: $LOKALBOARDS_KEY " \
-H "Content-Type: application/json" \
-d '{
"boardId": 123,
"mail": "newcomer@example.com",
"permission": "edit"
}'
const response = await fetch ( "https://boards.example.com/api/data/invite" , {
method: "POST" ,
headers: {
"X-API-Key" : apiKey,
"Content-Type" : "application/json" ,
},
body: JSON . stringify ({
boardId: 123 ,
mail: "newcomer@example.com" ,
permission: "edit" ,
}),
});
if ( ! response.ok) throw new Error ( await response. text ());
const data = await response. json ();
< script setup >
const config = useRuntimeConfig ();
const pending = ref ( false );
async function inviteToBoard () {
pending.value = true ;
try {
return await $fetch ( "https://boards.example.com/api/data/invite" , {
method: "POST" ,
headers: { "X-API-Key" : config.lokalBoardsKey },
body: {
boardId: 123 ,
mail: "newcomer@example.com" ,
permission: "edit" ,
},
});
} finally {
pending.value = false ;
}
}
</ script >
< template >
< button :disabled = "pending" @click = "inviteToBoard()" >Send invitation</ button >
</ template >
import { useState } from "react" ;
export function Example ({ apiKey }) {
const [ pending , setPending ] = useState ( false );
async function inviteToBoard () {
setPending ( true );
const response = await fetch ( "https://boards.example.com/api/data/invite" , {
method: "POST" ,
headers: {
"X-API-Key" : apiKey,
"Content-Type" : "application/json" ,
},
body: JSON . stringify ({
boardId: 123 ,
mail: "newcomer@example.com" ,
permission: "edit" ,
}),
});
setPending ( false );
return response. json ();
}
return (
< button disabled = {pending} onClick = {inviteToBoard}>
Send invitation
</ button >
);
}
<?php
$ch = curl_init('https://boards.example.com/api/data/invite');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey,
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'boardId' => 123,
'mail' => "newcomer@example.com",
'permission' => "edit",
]));
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
The response is the same whether the address had an account or was sent an
invitation, so the API cannot be used to find out which addresses are registered.
Takes access away again. Owner only.
Name Type Required Description boardIdinteger yes The board. userIdstring yes The account losing access.
cURL JavaScript Vue React PHP
curl -X DELETE "https://boards.example.com/api/data/invite?boardId=123&userId=8f3c1e2a" \
-H "X-API-Key: $LOKALBOARDS_KEY "
const response = await fetch ( "https://boards.example.com/api/data/invite?boardId=123&userId=8f3c1e2a" , {
method: "DELETE" ,
headers: {
"X-API-Key" : apiKey,
},
});
if ( ! response.ok) throw new Error ( await response. text ());
const data = await response. json ();
< script setup >
const config = useRuntimeConfig ();
const pending = ref ( false );
async function removeMember () {
pending.value = true ;
try {
return await $fetch ( "https://boards.example.com/api/data/invite?boardId=123&userId=8f3c1e2a" , {
method: "DELETE" ,
headers: { "X-API-Key" : config.lokalBoardsKey },
});
} finally {
pending.value = false ;
}
}
</ script >
< template >
< button :disabled = "pending" @click = "removeMember()" >Remove access</ button >
</ template >
import { useState } from "react" ;
export function Example ({ apiKey }) {
const [ pending , setPending ] = useState ( false );
async function removeMember () {
setPending ( true );
const response = await fetch ( "https://boards.example.com/api/data/invite?boardId=123&userId=8f3c1e2a" , {
method: "DELETE" ,
headers: {
"X-API-Key" : apiKey,
},
});
setPending ( false );
return response. json ();
}
return (
< button disabled = {pending} onClick = {removeMember}>
Remove access
</ button >
);
}
<?php
$ch = curl_init('https://boards.example.com/api/data/invite?boardId=123&userId=8f3c1e2a');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);