API Module
The Appmixer SDK uses this API module internally to connect to the REST API.
Name | Description |
---|---|
| Set configuration property. |
| Get configuration property. |
| Add event listener. |
| Remove event listener. |
Methods
api.authenticateUser
api.authenticateUser
Authenticate a user to Appmixer. Note that this can be a "virtual" user that exists for the sole purpose of associating a real user of your own product to a user in Appmixer. Each user in Appmixer can have a set of flows, can run and stop flows, and can see data going through their flows. The returned promise is either resolved with an object that contains a token (which you need to set with appmixer.set('accessToken', token)
to be able to make calls to the API backend. Or the promise is rejected with an error object. If the error object returns a 403 status code (i.e. err.response.status === 403
), the user does not exist in Appmixer.
api.authenticateWithEmailAndPassword
api.authenticateWithEmailAndPassword
Similar to the api.authenticateUser
, but uses email instead of username.
api.signupUser
api.signupUser
Create a new user in Appmixer. The returned promise is either resolved with an authentication object (containing the token
property) or rejected if the sign-up fails. If the email
parameter is not provided, then the username
will be copied as email.
api.createFlow
api.createFlow
appmixer.api.createFlow(name, [descriptor], [properties])
Create a new flow in Appmixer. The returned promise resolves to the ID of the newly created flow. The properties
object can contain your own custom metadata inside the customFields
property. This is especially useful for filtering flows based on your own custom metadata.
api.deleteFlow
api.deleteFlow
Delete an existing flow identified by flowId
.
api.getFlow
api.getFlow
Get flow. The returned promise resolves to an object with the following information: { id, flow, name, stage, btime, mtime, thumbnail }
, where flow
is the Flow Descriptor, stage
is either 'running'
or 'stopped'
, btime
is the time the flow was created ("birth" time), mtime
is the time the flow was modified and thumbnail contains a thumbnail image (self-contained, in the Data URI format).
api.getFlows
api.getFlows
Get all flows of the user or filter them by query
. query
is an object with the following properties: limit
, offset
, pattern
(a string to filter flows containing pattern in their names), sort
, projection
(allows you to exclude properties from the returned flow objects), sharedWithPermissions
and filter
.Example:
api.getFlowsCount
api.getFlowsCount
Get the number of all flows of the user or filter them by query
. query
is an object with pattern
property that can include a string to filter flows containing a pattern in their names. Example: { "pattern": "dropbox" }
.
api.updateFlow
api.updateFlow
Update an existing flow. update
can contain the following information: { flow, name, customFields }
, where flow
is the Flow Descriptor of the flow and customFields
is an object with your own custom metadata for this flow.
api.startFlow
api.startFlow
Start a flow.
api.stopFlow
api.stopFlow
Stop a flow.
api.cloneFlow
api.cloneFlow
Create a copy of an existing flow. The returned promise resolves to the ID of the newly created flow.
api.getUser
api.getUser
Get current user. The returned promise resolves to an object with username
.
api.getStores
api.getStores
Get all the data stores. The returned promise resolves to an array of stores each an object with name
and storeId
properties.
api.getStore
api.getStore
Get one store. The returned promise resolves to an object with name
and storeId
properties.
api.getStoreRecordsCount
api.getStoreRecordsCount
Get the number of records in a store. query
is an object with storeId
and pattern
properties where pattern
is a string to filter records that contain the string in their keys or values.
api.getStoreRecords
api.getStoreRecords
Get store records. query
is an object with storeId
, pattern
(string to search for in keys/values), limit
, offset
and sort
properties. Example:
api.createStore
api.createStore
Create a new store. The returned promise resolves to the ID of the newly created store.
api.deleteStore
api.deleteStore
Delete a store.
api.renameStore
api.renameStore
Rename an existing store.
api.createStoreItem
api.createStoreItem
Create a new record in a store.
api.deleteStoreItems
api.deleteStoreItems
Delete store items. items
is an array of objects each having a key
and storeId
properties identifying the item and store from which the item should be removed.
api.createAccount
api.createAccount
Create a custom account.
api.getAccounts
api.getAccounts
Get a list of connected accounts of the user. filter
is a custom query string (see the GET /accounts for an example). The returned promise resolves to an array of objects of the form { accountId, name, displayName, service, icon, profileInfo }
.
api.getComponentAccounts
api.getComponentAccounts
Get a list of accounts connected to a specific component.
api.getAccountFlows
api.getAccountFlows
Get a list of flows this account is used in. The returned promise resolves to an array of objects with flowId
and name
properties.
api.setAccountName
api.setAccountName
Rename a connected account. Note that this name is displayed in the Accounts widget and also in the Inspector UI of the Designer.
api.getLogs
api.getLogs
Get logs. The query
is an object of the form { from, size, sort, query }
:
Get logs of a specific flow:
api.getLog
api.getLog
Get one log. logId
and index
are values returned from getLogs()
.
api.getPeopleTasks
api.getPeopleTasks
Get all tasks of the user. query.role
can be either "approver" or "requester" and allows you to filter tasks based on the role. query.pattern
filters returned tasks by a term that must be contained in the task title. Settingquery.secret
to either the approverSecret
or requesterSecret
allows you to get a list of tasks of a different user for which you have the secret (other than the one identified by the access token, i.e. the currently signed-in user).
api.getPeopleTasksCount
api.getPeopleTasksCount
Returns the number of tasks based on the query. See getPeopleTasks(query)
for more info.
api.getPeopleTask
api.getPeopleTask
Return one task identified by id
.
api.approveTask
api.approveTask
Approve a task identified by id
. params
is an optional object that can contain the secret
property (approver secret). Having the secret allows you to approve a task of any user for which you have the secret, not just the currently signed-in user.
api.rejectTask
api.rejectTask
Reject a task identified by id
. params
is an optional object that can contain the secret
property (approver secret). Having the secret allows you to reject a task of any user for which you have the secret, not just the currently signed-in user.
api.getCharts
api.getCharts
Returns all the Insights charts of the user.
api.getChart
api.getChart
Return one Insights chart identified by chartId
.
api.deleteChart
api.deleteChart
Delete an Insights chart identified by chartId
.
api.getFlowAuthentication
api.getFlowAuthentication
This request will return an object with all the components in the flow that have auth
section with all the available accounts.
Events
error
error
The event is triggered when a request fails with an error or when the access token is invalid.
warning
warning
The event is triggered when API validation fails with a warning.
Last updated