Fission Platform APIs
The webnative platform API provides methods to work with Fission apps.
The platform API makes it possible to manage user apps and, combined with the webnative filesystem methods, create and manage apps entirely from the browser.
Yes, you can build an app, that creates apps on behalf of the user! This is a way for developers to make use of the Fission Platform to build their own MicroSaaS business, including custom domains and other features for their users.
The API methods are prefixed with apps
.
apps.index
: A list of all of your apps and their associated domain names
apps.create
: Creates a new app, assigns an initial subdomain, and sets an asset placeholder
apps.publish
: Publish a new app version
apps.deleteByDomain
: Destroy an app identified by domain
Apps that use the platform API must request permission to work with a user's apps. Permissions are requested when a user signs in through the Fission Auth Lobby. See the requesting capabilities guide for more on requesting permissions.
Platform API permissions are requested at permissions.platform.apps
in the configuration object.
The value at permissions.platform.apps
can be
"*"
: Grant complete app management access for all of the user's apps
An array of domain names, e.g. [ "an-app.fission.app", "another-app.fission.app" ]
: Grant permission to manage specific apps. Those apps can be published or deleted.
These app function are a bit more low level than your usual Webnative functions. This is because these functions are specifically for the Fission architecture, while the rest of Webnative is not. We'll need two things to get started, the endpoints
and the dependencies
:
apps.index
Lists all user apps and their associated domain names.
Required permissions: { platform: { apps: "*" } }
full app management permissions
Params: No parameters
Returns: App[]
with the domain names, creation and modification times for each app
Example:
apps.create
Creates a new app, assigns an initial subdomain, and publishes a placeholder site.
Required permissions: { platform: { apps: "*" } }
full app management permissions
Params:
subdomain: string | null
optional, set to null
to generate a name
Returns: { domain: string }
the subdomain of the newly created app
Example:
apps.publish
Publishes a new app version by IPFS CID. If the app does not exist yet, create the app first with apps.create
.
Required permissions: Needs either permission for the app domain or full app management permissions. See Permissions.
Params:
domain: string
required
cid: CID
required
Returns: Nothing returned
Example:
Retrieving the CID depends on where you have staged the app code. One convenient way to do this is to publish the app's HTML, CSS, JavaScript, and assets to a public directory in WNFS and retrieve the CID of that directory.
apps.deleteByDomain
Delete an app by domain.
Required permissions: Needs either permission for the app domain or full app management permissions. See Permissions.
Params:
url: string
required
Returns: Nothing returned
Example: