import {attioFetch} from "attio/server"

Calls the Attio REST API. It’s modeled after the Node fetch() API.

The auth credentials passed to the REST API will be those of your app.

What the API will allow you to do depends on the scopes granted to your app.

Arguments

An object containing:

method : "GET" | "POST" | "DELETE" | "PATCH"

The HTTP method to use.

queryParams? : Record<string, unknown>

The query parameters to use in the HTTP request.

body? : { data?: Record<string, unknown>, filter?: Record<string, unknown> }

The body of the HTTP request.

In the Attio REST API, this is always an object with key "data" or "filter".

Returns

An object containing:

data : Record<string, unknown> | Array<Record<string, unknown>>

The result of the Attio REST endpoint.

Example Usage

import {attioFetch} from "attio/server"

...

const notes = await attioFetch({
    method: "GET",
    path: "/notes",
})

notes.data.forEach(note => {
  // do something with each note
})