Application Connections

List Application Connections

SDK Method

ApplicationConnection.list()

Return Object

ApplicationConnection[]

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Additional Arguments

Example Request

import ApplicationConnection from 'files.com/lib/models/ApplicationConnection.js';
import * as FilesErrors from 'files.com/lib/Errors.js';

try {
  const applicationConnections = await ApplicationConnection.list();
  for (const applicationConnection of applicationConnections) {
    // Operate on applicationConnection
  }
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Show Application Connection

SDK Method

ApplicationConnection.find()

Return Object

ApplicationConnection

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Method Arguments

ArgumentDescription
id
int64
Required
Application Connection ID.

Example Request

import ApplicationConnection from 'files.com/lib/models/ApplicationConnection.js';
import * as FilesErrors from 'files.com/lib/Errors.js';

try {
  const applicationConnection = await ApplicationConnection.find(id);
  // Operate on applicationConnection
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Create Application Connection

SDK Method

ApplicationConnection.create()

Return Object

ApplicationConnection

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Method Arguments

ArgumentDefaultDescription
name
string
Required
Connection display name.
secret_id
int64
ID of the credential in the Secret Store, if the connection uses a credential.
application_key
string
Required
Application key from the Automation applications list.
origin
string
Required
HTTPS origin for this connection.
workspace_id
int64
0Workspace that owns this connection.

Example Request

import ApplicationConnection from 'files.com/lib/models/ApplicationConnection.js';
import * as FilesErrors from 'files.com/lib/Errors.js';

try {
  const applicationConnection = await ApplicationConnection.create({
    name: "example",
    application_key: "example",
    origin: "example",
  });
  // Operate on applicationConnection
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Update Application Connection

SDK Method

applicationConnection.update()

Return Object

ApplicationConnection

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Method Arguments

ArgumentDescription
name
string
Connection display name.
secret_id
int64
ID of the credential in the Secret Store, if the connection uses a credential.

Example Request

import ApplicationConnection from 'files.com/lib/models/ApplicationConnection.js';
import * as FilesErrors from 'files.com/lib/Errors.js';

try {
  // Find the applicationConnection object by its id.
  const applicationConnection = await ApplicationConnection.find(id);
  await applicationConnection.update({
    name: "example",
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Delete Application Connection

SDK Method

applicationConnection.delete()

Return Object

No return value.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Example Request

import ApplicationConnection from 'files.com/lib/models/ApplicationConnection.js';
import * as FilesErrors from 'files.com/lib/Errors.js';

try {
  // Find the applicationConnection object by its id.
  const applicationConnection = await ApplicationConnection.find(id);
  await applicationConnection.delete();
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

The ApplicationConnection Object

Some of the methods above return a ApplicationConnection object. The attributes of this object are listed below.

AttributeDescription
id
int64
Connection ID.
workspace_id
int64
Workspace that owns this connection.
name
string
Connection display name.
application_key
string
Application key from the Automation applications list.
origin
string
HTTPS origin for this connection.
secret_id
int64
ID of the credential in the Secret Store, if the connection uses a credential.
authentication
object
Current credential type and placement, without the secret value.
created_at
date-time
Time the connection was created.
updated_at
date-time
Time the connection was updated.