Class: WebLinks

WebLinks(client) → {void}

Simple manager for interacting with all 'Weblinks' endpoints and actions.

Constructor

Parameters:
Name Type Description
client BoxClient The Box API Client that is responsible for making calls to the API
Source:
Returns:
Type
void

Methods

addToCollection(webLinkID, collectionID, callbackopt) → {Promise.<Object>}

Add a web link to a given collection API Endpoint: '/web_links/:webLinkID' Method: PUT
Parameters:
Name Type Attributes Description
webLinkID string The web link to add to the collection
collectionID string The collection to add the web link to
callback function <optional>
Passed the updated web link if successful, error otherwise
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

addToCollection(webLinkID, collectionID, callbackopt) → {Promise.<Object>}

Add a web link to a given collection API Endpoint: '/web_links/:webLinkID' Method: PUT
Parameters:
Name Type Attributes Description
webLinkID string The web link to add to the collection
collectionID string The collection to add the web link to
callback function <optional>
Passed the updated web link if successful, error otherwise
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

copy(webLinkID, newParentID, optionsopt, callbackopt) → {Promise.<Object>}

Copy a web link into a new, different folder API Endpoint: '/web_links/:webLinkID/copy Method: POST
Parameters:
Name Type Attributes Description
webLinkID string The Box ID of the web link being requested
newParentID string The Box ID for the new parent folder. '0' to copy to All Files.
options Object <optional>
Optional parameters for the copy operation, can be left null in most cases
Properties
Name Type Attributes Description
name string <optional>
A new name to use if there is an identically-named item in the new parent folder
callback function <optional>
passed the new web link info if call was successful
Source:
Returns:
A promise resolving to the new web link object
Type
Promise.<Object>

copy(webLinkID, newParentID, optionsopt, callbackopt) → {Promise.<Object>}

Copy a web link into a new, different folder API Endpoint: '/web_links/:webLinkID/copy Method: POST
Parameters:
Name Type Attributes Description
webLinkID string The Box ID of the web link being requested
newParentID string The Box ID for the new parent folder. '0' to copy to All Files.
options Object <optional>
Optional parameters for the copy operation, can be left null in most cases
Properties
Name Type Attributes Description
name string <optional>
A new name to use if there is an identically-named item in the new parent folder
callback function <optional>
passed the new web link info if call was successful
Source:
Returns:
A promise resolving to the new web link object
Type
Promise.<Object>

create(url, parentID, optionsopt, callbackopt) → {Promise.<Object>}

Creates a web link object within a given folder. API Endpoint: '/web_links' Method: POST
Parameters:
Name Type Attributes Description
url string URL you want the web link to point to. Must include http:// or https://
parentID string The ID of the parent folder where you're creating the web link
options Object <optional>
Additional parameters
Properties
Name Type Attributes Description
name string <optional>
Name for the web link. Will default to the URL if empty.
description string <optional>
Description of the web link. Will provide more context to users about the web link.
callback function <optional>
Passed the new web link information if it was acquired successfully, error otherwise
Source:
Returns:
A promise resolving to the created weblink object
Type
Promise.<Object>

create(url, parentID, optionsopt, callbackopt) → {Promise.<Object>}

Creates a web link object within a given folder. API Endpoint: '/web_links' Method: POST
Parameters:
Name Type Attributes Description
url string URL you want the web link to point to. Must include http:// or https://
parentID string The ID of the parent folder where you're creating the web link
options Object <optional>
Additional parameters
Properties
Name Type Attributes Description
name string <optional>
Name for the web link. Will default to the URL if empty.
description string <optional>
Description of the web link. Will provide more context to users about the web link.
callback function <optional>
Passed the new web link information if it was acquired successfully, error otherwise
Source:
Returns:
A promise resolving to the created weblink object
Type
Promise.<Object>

delete(weblinkID, callbackopt) → {Promise.<Object>}

Deletes a web link and moves it to the trash API Endpoint: '/web_links/:weblinkID' Method: DELETE
Parameters:
Name Type Attributes Description
weblinkID string The Box ID of the web link being moved to the trash
callback function <optional>
Empty body passed if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<Object>

delete(weblinkID, callbackopt) → {Promise.<Object>}

Deletes a web link and moves it to the trash API Endpoint: '/web_links/:weblinkID' Method: DELETE
Parameters:
Name Type Attributes Description
weblinkID string The Box ID of the web link being moved to the trash
callback function <optional>
Empty body passed if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<Object>

get(weblinkID, optionsopt, callbackopt) → {Promise.<Object>}

Use to get information about the web link. API Endpoint: '/web_links/:weblinkID' Method: GET
Parameters:
Name Type Attributes Description
weblinkID string The Box ID of web link being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the web-link information if it was acquired successfully, error otherwise
Source:
Returns:
A promise resolving to the weblink object
Type
Promise.<Object>

get(weblinkID, optionsopt, callbackopt) → {Promise.<Object>}

Use to get information about the web link. API Endpoint: '/web_links/:weblinkID' Method: GET
Parameters:
Name Type Attributes Description
weblinkID string The Box ID of web link being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the web-link information if it was acquired successfully, error otherwise
Source:
Returns:
A promise resolving to the weblink object
Type
Promise.<Object>

move(webLinkID, newParentID, callbackopt) → {Promise.<Object>}

Move a web link into a new parent folder. API Endpoint: '/web_links/:webLinkID' Method: PUT
Parameters:
Name Type Attributes Description
webLinkID string The Box ID of the web link being requested
newParentID string The Box ID for the new parent folder. '0' to move to All Files.
callback function <optional>
Passed the updated web link information if it was acquired successfully
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

move(webLinkID, newParentID, callbackopt) → {Promise.<Object>}

Move a web link into a new parent folder. API Endpoint: '/web_links/:webLinkID' Method: PUT
Parameters:
Name Type Attributes Description
webLinkID string The Box ID of the web link being requested
newParentID string The Box ID for the new parent folder. '0' to move to All Files.
callback function <optional>
Passed the updated web link information if it was acquired successfully
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

removeFromCollection(webLinkID, collectionID, callbackopt) → {Promise.<Object>}

Remove a web link from a given collection API Endpoint: '/web_links/:webLinkID' Method: PUT
Parameters:
Name Type Attributes Description
webLinkID string The web link to remove from the collection
collectionID string The collection to remove the web link from
callback function <optional>
Passed the updated web link if successful, error otherwise
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

removeFromCollection(webLinkID, collectionID, callbackopt) → {Promise.<Object>}

Remove a web link from a given collection API Endpoint: '/web_links/:webLinkID' Method: PUT
Parameters:
Name Type Attributes Description
webLinkID string The web link to remove from the collection
collectionID string The collection to remove the web link from
callback function <optional>
Passed the updated web link if successful, error otherwise
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

update(weblinkID, updates, callbackopt) → {Promise.<Object>}

Updates information for a web link. API Endpoint: '/web_links/:weblinkID' Method: PUT
Parameters:
Name Type Attributes Description
weblinkID string The Box ID of the web link being updated
updates Object Fields of the weblink to update
Properties
Name Type Attributes Description
name string <optional>
Name for the web link. Will default to the URL if empty.
description string <optional>
Description of the web link. Will provide more context to users about the web link.
callback function <optional>
Passed the updated web link information if it was acquired successfully, error otherwise
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>

update(weblinkID, updates, callbackopt) → {Promise.<Object>}

Updates information for a web link. API Endpoint: '/web_links/:weblinkID' Method: PUT
Parameters:
Name Type Attributes Description
weblinkID string The Box ID of the web link being updated
updates Object Fields of the weblink to update
Properties
Name Type Attributes Description
name string <optional>
Name for the web link. Will default to the URL if empty.
description string <optional>
Description of the web link. Will provide more context to users about the web link.
callback function <optional>
Passed the updated web link information if it was acquired successfully, error otherwise
Source:
Returns:
A promise resolving to the updated web link object
Type
Promise.<Object>