List users
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.crm.users.list({
serviceId: "salesforce",
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { crmUsersList } from "@apideck/unify/funcs/crmUsersList.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const res = await crmUsersList(apideck, {
serviceId: "salesforce",
passThrough: {
"search": "San Francisco",
},
fields: "id,updated_at",
});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("crmUsersList failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CrmUsersAllRequest | ✔️ | 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. |
Promise<operations.CrmUsersAllResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponse | 400 | application/json |
| errors.UnauthorizedResponse | 401 | application/json |
| errors.PaymentRequiredResponse | 402 | application/json |
| errors.NotFoundResponse | 404 | application/json |
| errors.UnprocessableResponse | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Create user
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.crm.users.create({
serviceId: "salesforce",
user: {
parentId: "54321",
username: "masterofcoin",
firstName: "Elon",
lastName: "Musk",
title: "CEO",
division: "Europe",
companyName: "SpaceX",
employeeNumber: "123456-AB",
description: "A description",
image: "https://logo.clearbit.com/spacex.com?s=128",
language: "EN",
status: "active",
password: "supersecretpassword",
addresses: [
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
],
phoneNumbers: [
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
],
emails: [
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
],
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
console.log(result);
}
run();The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { crmUsersCreate } from "@apideck/unify/funcs/crmUsersCreate.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const res = await crmUsersCreate(apideck, {
serviceId: "salesforce",
user: {
parentId: "54321",
username: "masterofcoin",
firstName: "Elon",
lastName: "Musk",
title: "CEO",
division: "Europe",
companyName: "SpaceX",
employeeNumber: "123456-AB",
description: "A description",
image: "https://logo.clearbit.com/spacex.com?s=128",
language: "EN",
status: "active",
password: "supersecretpassword",
addresses: [
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
],
phoneNumbers: [
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
],
emails: [
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
],
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("crmUsersCreate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CrmUsersAddRequest | ✔️ | 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. |
Promise<operations.CrmUsersAddResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponse | 400 | application/json |
| errors.UnauthorizedResponse | 401 | application/json |
| errors.PaymentRequiredResponse | 402 | application/json |
| errors.NotFoundResponse | 404 | application/json |
| errors.UnprocessableResponse | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Get user
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.crm.users.get({
id: "<id>",
serviceId: "salesforce",
fields: "id,updated_at",
});
console.log(result);
}
run();The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { crmUsersGet } from "@apideck/unify/funcs/crmUsersGet.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const res = await crmUsersGet(apideck, {
id: "<id>",
serviceId: "salesforce",
fields: "id,updated_at",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("crmUsersGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CrmUsersOneRequest | ✔️ | 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. |
Promise<operations.CrmUsersOneResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponse | 400 | application/json |
| errors.UnauthorizedResponse | 401 | application/json |
| errors.PaymentRequiredResponse | 402 | application/json |
| errors.NotFoundResponse | 404 | application/json |
| errors.UnprocessableResponse | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Update user
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.crm.users.update({
id: "<id>",
serviceId: "salesforce",
user: {
parentId: "54321",
username: "masterofcoin",
firstName: "Elon",
lastName: "Musk",
title: "CEO",
division: "Europe",
companyName: "SpaceX",
employeeNumber: "123456-AB",
description: "A description",
image: "https://logo.clearbit.com/spacex.com?s=128",
language: "EN",
status: "active",
password: "supersecretpassword",
addresses: [
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
],
phoneNumbers: [
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
],
emails: [
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
],
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
console.log(result);
}
run();The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { crmUsersUpdate } from "@apideck/unify/funcs/crmUsersUpdate.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const res = await crmUsersUpdate(apideck, {
id: "<id>",
serviceId: "salesforce",
user: {
parentId: "54321",
username: "masterofcoin",
firstName: "Elon",
lastName: "Musk",
title: "CEO",
division: "Europe",
companyName: "SpaceX",
employeeNumber: "123456-AB",
description: "A description",
image: "https://logo.clearbit.com/spacex.com?s=128",
language: "EN",
status: "active",
password: "supersecretpassword",
addresses: [
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
{
id: "123",
type: "primary",
string: "25 Spring Street, Blackburn, VIC 3130",
name: "HQ US",
line1: "Main street",
line2: "apt #",
line3: "Suite #",
line4: "delivery instructions",
streetNumber: "25",
city: "San Francisco",
state: "CA",
postalCode: "94104",
country: "US",
latitude: "40.759211",
longitude: "-73.984638",
county: "Santa Clara",
contactName: "Elon Musk",
salutation: "Mr",
phoneNumber: "111-111-1111",
fax: "122-111-1111",
email: "elon@musk.com",
website: "https://elonmusk.com",
notes: "Address notes or delivery instructions.",
rowVersion: "1-12345",
},
],
phoneNumbers: [
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
{
id: "12345",
countryCode: "1",
areaCode: "323",
number: "111-111-1111",
extension: "105",
type: "primary",
},
],
emails: [
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
{
id: "123",
email: "elon@musk.com",
type: "primary",
},
],
passThrough: [
{
serviceId: "<id>",
extendPaths: [
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
path: "$.nested.property",
value: {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
],
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("crmUsersUpdate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CrmUsersUpdateRequest | ✔️ | 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. |
Promise<operations.CrmUsersUpdateResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponse | 400 | application/json |
| errors.UnauthorizedResponse | 401 | application/json |
| errors.PaymentRequiredResponse | 402 | application/json |
| errors.NotFoundResponse | 404 | application/json |
| errors.UnprocessableResponse | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Delete user
import { Apideck } from "@apideck/unify";
const apideck = new Apideck({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const result = await apideck.crm.users.delete({
id: "<id>",
serviceId: "salesforce",
});
console.log(result);
}
run();The standalone function version of this method:
import { ApideckCore } from "@apideck/unify/core.js";
import { crmUsersDelete } from "@apideck/unify/funcs/crmUsersDelete.js";
// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
apiKey: process.env["APIDECK_API_KEY"] ?? "",
});
async function run() {
const res = await crmUsersDelete(apideck, {
id: "<id>",
serviceId: "salesforce",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("crmUsersDelete failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CrmUsersDeleteRequest | ✔️ | 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. |
Promise<operations.CrmUsersDeleteResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponse | 400 | application/json |
| errors.UnauthorizedResponse | 401 | application/json |
| errors.PaymentRequiredResponse | 402 | application/json |
| errors.NotFoundResponse | 404 | application/json |
| errors.UnprocessableResponse | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |