Skip to content

Latest commit

 

History

History
859 lines (676 loc) · 56 KB

File metadata and controls

859 lines (676 loc) · 56 KB

Entries

Overview

Entries are elements in a list that reference a single parent record. Entries contain their own data from attributes defined on the list and also data from their parent record. See our objects and lists guide for more information.

Available Operations

  • query - List entries
  • create - Create an entry (add record to list)
  • assert - Upsert a list entry by parent
  • get - Get a list entry
  • update - Update a list entry (overwrite multiselect values)
  • delete - Delete a list entry
  • updateAppending - Update a list entry (append multiselect values)
  • listAttributeValues - List attribute values for a list entry

query

Lists entries in a given list, with the option to filter and sort results.

Required scopes: list_entry:read, list_configuration:read.

Example Usage: Filter by attribute

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.query({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      filter: {
        "name": "Ada Lovelace",
      },
      sorts: [
        {
          direction: "asc",
          attribute: "name",
          field: "last_name",
        },
      ],
      limit: 500,
      offset: 0,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesQuery } from "@interfere/attio/funcs/entries-query.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesQuery(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      filter: {
        "name": "Ada Lovelace",
      },
      sorts: [
        {
          direction: "asc",
          attribute: "name",
          field: "last_name",
        },
      ],
      limit: 500,
      offset: 0,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesQuery failed:", res.error);
  }
}

run();

Example Usage: Filter by view

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.query({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      filterViewId: "cf7aaeb5-7507-4a84-9c26-9d36e34d7b70",
      sorts: [
        {
          direction: "asc",
          attribute: "name",
          field: "last_name",
        },
      ],
      limit: 500,
      offset: 0,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesQuery } from "@interfere/attio/funcs/entries-query.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesQuery(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      filterViewId: "cf7aaeb5-7507-4a84-9c26-9d36e34d7b70",
      sorts: [
        {
          direction: "asc",
          attribute: "name",
          field: "last_name",
        },
      ],
      limit: 500,
      offset: 0,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesQuery failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.QueryEntriesRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.QueryEntriesResponse>

Errors

Error Type Status Code Content Type
errors.QueryEntriesNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

create

Adds a record to a list as a new list entry. This endpoint will throw on conflicts of unique attributes. Multiple list entries are allowed for the same parent record

Required scopes: list_entry:read-write, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.create({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      data: {
        parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
        parentObject: "people",
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesCreate } from "@interfere/attio/funcs/entries-create.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesCreate(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      data: {
        parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
        parentObject: "people",
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CreateEntryRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.CreateEntryResponse>

Errors

Error Type Status Code Content Type
errors.CreateEntryValueNotFoundError 400 application/json
errors.CreateEntryNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

assert

Use this endpoint to create or update a list entry for a given parent record. If an entry with the specified parent record is found, that entry will be updated. If no such entry is found, a new entry will be created instead. If there are multiple entries with the same parent record, this endpoint with return the "MULTIPLE_MATCH_RESULTS" error. When writing to multi-select attributes, all values will be either created or deleted as necessary to match the list of values supplied in the request body.

Required scopes: list_entry:read-write, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.assert({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      data: {
        parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
        parentObject: "people",
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesAssert } from "@interfere/attio/funcs/entries-assert.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesAssert(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    body: {
      data: {
        parentRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
        parentObject: "people",
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesAssert failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AssertEntryRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.AssertEntryResponse>

Errors

Error Type Status Code Content Type
errors.MultipleMatchResultsError 400 application/json
errors.AssertEntryNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

get

Gets a single list entry by its entry_id.

Required scopes: list_entry:read, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.get({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesGet } from "@interfere/attio/funcs/entries-get.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesGet(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesGet failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetEntryRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetEntryResponse>

Errors

Error Type Status Code Content Type
errors.GetEntryNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

update

Use this endpoint to update list entries by entry_id. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the PATCH endpoint to add multiselect attribute values without removing those value that already exist.

Required scopes: list_entry:read-write, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.update({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    body: {
      data: {
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesUpdate } from "@interfere/attio/funcs/entries-update.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesUpdate(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    body: {
      data: {
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesUpdate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateEntryRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.UpdateEntryResponse>

Errors

Error Type Status Code Content Type
errors.UpdateEntryImmutableValueError 400 application/json
errors.UpdateEntryNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

delete

Deletes a single list entry by its entry_id.

Required scopes: list_entry:read-write, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.delete({
    list: "enterprise_sales",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesDelete } from "@interfere/attio/funcs/entries-delete.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesDelete(attio, {
    list: "enterprise_sales",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesDelete failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteEntryRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.DeleteEntryResponse>

Errors

Error Type Status Code Content Type
errors.DeleteEntryNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

updateAppending

Use this endpoint to update list entries by entry_id. If the update payload includes multiselect attributes, the values supplied will be created and prepended to the list of values that already exist (if any). Use the PUT endpoint to overwrite or remove multiselect attribute values.

Required scopes: list_entry:read-write, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.updateAppending({
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    body: {
      data: {
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesUpdateAppending } from "@interfere/attio/funcs/entries-update-appending.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesUpdateAppending(attio, {
    list: "33ebdbe9-e529-47c9-b894-0ba25e9c15c0",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    body: {
      data: {
        entryValues: {
          "41252299-f8c7-4b5e-99c9-4ff8321d2f96": [
            "Text value",
          ],
          "multiselect_attribute": [
            "Select option 1",
            "Select option 2",
          ],
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesUpdateAppending failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateAppendingEntryRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.UpdateAppendingEntryResponse>

Errors

Error Type Status Code Content Type
errors.UpdateAppendingEntryImmutableValueError 400 application/json
errors.UpdateAppendingEntryNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*

listAttributeValues

Gets all values for a given attribute on a list entry. This endpoint has the ability to return all historic values using the show_historic query param. Historic values are sorted from oldest to newest (by active_from).

Required scopes: list_entry:read, list_configuration:read.

Example Usage

import { Attio } from "@interfere/attio";

const attio = new Attio({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const result = await attio.entries.listAttributeValues({
    list: "enterprise_sales",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    attribute: "41252299-f8c7-4b5e-99c9-4ff8321d2f96",
    showHistoric: true,
    limit: 10,
    offset: 5,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { AttioCore } from "@interfere/attio/core.js";
import { entriesListAttributeValues } from "@interfere/attio/funcs/entries-list-attribute-values.js";

// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
  oauth2: process.env["ATTIO_OAUTH2"] ?? "",
});

async function run() {
  const res = await entriesListAttributeValues(attio, {
    list: "enterprise_sales",
    entryId: "2e6e29ea-c4e0-4f44-842d-78a891f8c156",
    attribute: "41252299-f8c7-4b5e-99c9-4ff8321d2f96",
    showHistoric: true,
    limit: 10,
    offset: 5,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("entriesListAttributeValues failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListEntryAttributeValuesRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListEntryAttributeValuesResponse>

Errors

Error Type Status Code Content Type
errors.ListEntryAttributeValuesNotFoundError 404 application/json
errors.AttioError 4XX, 5XX */*