Class: Datasources

Datasources

new Datasources(domain)

Parameters:
Name Type Description
domain string The project domain
Source:

Methods

createCollection(category, datasource, name, token)

This method creates a new collection within a data source.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
name string The name of the new collection.,
token string A project token.,
Source:

createDatasource(category, name, token, default, credentials)

This method creates a new data source. According to the specified data source category, the connection to the data source will be tested within this method. If the test does not pass the credentials will not be stored and the reponse status code will be set to 422.

Currently, the default MongoDB data source cannot be created using this method.

Parameters:
Name Type Description
category string The data source category.,
name string The name of the data source. The data source name can contain any alphabetic letter, numbers, dots, or dashes, and must start with an alphabetic letter.,
token string A project token.,
default boolean Whether the new data source will be the default one for its category. The default value is false.,
credentials string The data sources credentials as JSON.,
Source:

getCollectionMetadata(category, datasource, collection, token)

This method retrieves the metadata of a collection.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
token string A project token.,
Source:

getDatasource(category, datasource, token)

This method retrieves credentials from data source.

Currently, the default MongoDB credentials cannot be retrieved using this method.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
token string A project token.,
Source:

getDatasourceContents(category, datasource, token)

This method retrieves the list of available collections from a data source.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
token string A project token.,
Source:

getItem(category, datasource, collection, identifier, token)

This method retrieves a collection item.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
identifier string The item identifier.,
token string A project token.,
Source:

insertInCollection(category, datasource, collection, token, item)

This method inserts an item into a data source collection.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
token string A project token.,
item string The item to insert.,
Source:

listCategoryDatasources(category, token)

This method retrieves the list of data sources from a specific category configured for the project. If no data source is present in the specified category an empty array is returned.

Parameters:
Name Type Description
category string The data source category.,
token string A project token.,
Source:

listCollection(category, datasource, collection, token, offset, limit, expand, Accept)

This method retrieves a list of items a the collection.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
token string A project token.,
offset integer The index of the first item from which to start listing the collection items. Default is 1.,
limit integer The number of collection items to list. Default is 10.,
expand boolean Whether to include the serialized item in the listing. The default value is false.,
Accept string Value of the Accept header.,
Source:

listDatasources(token)

This method retrieves the data sources that are configured for a project.

Parameters:
Name Type Description
token string A project token.,
Source:

removeCollection(category, datasource, collection, token)

This method removes a collection from a data source.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
token string A project token.,
Source:

removeDatasource(category, datasource, token)

This method removes a data source.

Currently, the default MongoDB data source cannot be deleted through this method.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
token string A project token.,
Source:

removeItem(category, datasource, collection, identifier, token)

This method removes an item from a collection

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
identifier string The item identifier.,
token string A project token.,
Source:

truncateCollection(category, datasource, collection, token)

This method truncates a collection.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
token string A project token.,
Source:

updateDatasource(category, datasource, token, name, default, credentials)

This method updates a data source changing its name, whether it is default or not, or its credentials. At least one change, that is, one of the optional parameters, must be specified.

Currently, the default MongoDB data source cannot be modified through this method.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
token string A project token.,
name string The new name of the data source. If not specified the data source is not renamed.,
default boolean Whether the data source should become (if true) or cease to be (if false) the default one for its category. If not specified the data source does not change its default status.,
credentials string The new data sources credentials as JSON. If not specified the data sources credentials are not changed,
Source:

updateItem(category, datasource, collection, identifier, token, item)

This method updates a collection item.

Currently, this method is only available for MongoDB data sources.

Parameters:
Name Type Description
category string The data source category.,
datasource string The data source name.,
collection string The collection name.,
identifier string The item identifier.,
token string A project token.,
item string The new item.,
Source: