Areas

The areas of one board, in their order.

GET /api/data/areas

Parameters

NameTypeRequiredDescription
boardIdintegeryesThe board whose areas you want.
curl -X GET "https://boards.example.com/api/data/areas?boardId=123" \
  -H "X-API-Key: $LOKALBOARDS_KEY"
const response = await fetch("https://boards.example.com/api/data/areas?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("areas", () =>
  $fetch("https://boards.example.com/api/data/areas?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/areas?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/areas?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);

Response

{
  "areas": [
    { "id": 10, "board": 123, "name": "Backlog", "sort": 0 },
    { "id": 11, "board": 123, "name": "In Progress", "sort": 1 },
    { "id": 12, "board": 123, "name": "Done", "sort": 2 }
  ]
}

sort is the left-to-right order in the KanBan style, top-to-bottom in ToDo. Change it with PATCH /api/data/board, which takes the whole order at once rather than one move at a time.