Building a product on top of Losant would normally involve writing an API service, implementing user authentication, building and serving a front-end interface, and hosting all of the above somewhere – which is a lot of work! Experiences bring all of this functionality directly inside your Losant application.
Experiences are a means by which you can build a fully functional web interface, allowing users to interact with your connected devices. Set a subdomain at which your custom views can live; return user-specific dashboards with content that is specifically relevant to them; configure endpoints to respond to requests using the power of Losant's workflow engine; register users against your application; and protect data access by assigning your users to groups.
Experience resources are subject to account resource limits, with all but the Users being soft limits (meaning you may request increases to these limits at potentially zero additional charge). If you need to register additional Experience Users, you will have to upgrade to an organization.
New applications Experiences must first go through a short bootstrapping process before you can begin using the features.
Choose a Slug#
The first step in working with Experiences is to choose a custom endpoint slug, which is a subdomain at which your endpoint requests will live. It is here that endpoint requests can be securely received and responded to. After initial setup, you may also configure one or more full domains for handling endpoint requests as well as additional endpoint slugs.
By default, your application experience includes a slug that matches your application ID; this slug cannot be deleted. If you choose to enter a custom slug during the bootstrapping process, the slug must meet these requirements:
- Must be at least 4 characters
- May only contain lowercase letters, numbers, hyphens (-) and underscores (_)
- Must be unique across the entire Losant Platform
- Cannot be a commonly used Internet subdomain, such as "webmail" or "cpanel"
- Cannot be profane (slugs violating this rule are subject to change without notice)
HTTP requests for your endpoints should then go to
Bootstrap Your Experience#
After choosing a slug, you'll have the option of setting up some example resources to get you started. This step can be skipped on a per-application basis, though we recommend completing it as a great starting point for building out a full experience.
If you choose to create the helper resources, Losant will automatically add the following to your application:
/loginendpoint (one for GET and one for POST requests), a backing workflow (which handles the actual authentication and routing), and the page to render when the endpoints are requested.
/logoutendpoint and a backing workflow for signing users out.
/(root) endpoint configured to render another page for signed-in users and to redirect to the login page for unauthenticated users.
- The layout and components necessary to render the pages listed above.
- A test Experience User for testing authentication and protected endpoints.
- An Experience Group with the test user as a member.
The sample resources utilize a placeholder brand and a layout wrapped in Twitter Bootstrap, a popular front-end framework whose stylesheets and script files are available on a content delivery network. You are free to continuing using this framework to build out your experience, or to swap it with another of your choosing (or no framework at all).
All of these resources can be updated or deleted at any time. If you delete all your experience resources, you will have the option of running the bootstrap process again.
Test Your Experience#
Finally, if you chose to create the sample resources, you'll receive instructions for testing your new endpoints and views. Click the link provided on the summary screen, which should redirect you to your new login page. Sign in with the provided credentials and you will then see the placeholder home page.
Take note of the random password assigned to your test user. If you lose this password, you will have to edit the user to reset it.
If you chose to skip the resource creation step, the modal will simply dismiss when you set your slug.
Deleting Experience Resources#
If for any reason you need to delete parts or all of your Experience, you can do so under the "Settings" > "Delete Resources" tab in your application's navigation. Select all the resources you wish to delete and then submit the form.