Hosted App

If you want to create a service that uses obniz running on your server, a hosted app is useful.
By creating a hosted app, you can retrieve information about the devices on which you or other users have installed the app via the API.
It also allows you to manage the accounts and devices of approved users.
You can let obniz cloud take care of things like linking apps to devices and saving settings.

Creating an App.

Select "Development" > "App development" from the developer console and enter the required information. After creating the app, you can set up the details.

Permissions.

This is the access rights that this app requests from the user in OAuth.

  • user: The user's account information such as email address
  • device: the device you own
  • repository: files in the repository (this feature is not published in the API)
  • event: Serverless event
  • device_control: Hardware API to connect to the devices in your account via obniz.js or other methods. can be set.

Set the following permissions for each
This will also appear on the user's authorization screen to confirm what this app is allowed to do.

  • NONE: Not required
  • read: read only
  • full: read/update/create

These permissions can be operated on the user's account after approval and are not related to the installation.

When a user installs an app on a device, regardless of the above permissions, the user will be granted read and device manipulation permissions for the installed device, user and device only.

WebhookURL.

The URL used in Webhook. See more detail at install

Application URL.

Your website can be displayed in an iFrame on the obniz cloud by setting it up.

Your URLs will be displayed in the

https://yoursite.com/

When a user selects an app from the "In Use" list, a link with the user's oauth token will open the web site.

https://yoursite.com/?token=XXXX

Also, if you press "Open App" per device, an obniz_id will be added.

https://yoursite.com/?token=XXXX&obniz_id=YYYY

You can display a web site that addresses these
Users will be able to open a specific page on your website right away without having to log in or select a device.

Installation Settings.

This is the setting item for users to install this app. If nothing is set, users can install the app at the touch of a button.

For example, you can set the interval between data fetching at the time of installation.

You can use the API to retrieve the settings your users have made during the installation process.

Creation and tokens.

Once the app is created, you will be able to see the app's id and token.
At this stage, you can use the API whether it's public or private to the store.
Even if no one has installed it, you can use it now if it's just an API call to get information about your app.
You can also use it right away to get the OAuth Token of a user or let the user install the app.

SDK

We provide the obniz-app-sdk, which contains the basic functions needed to create an app.

  • Registration of programs for each obniz device
  • Respond to new installations/updates/deletions in the obniz cloud
  • Load balancing by multiple servers using Redis

Please refer to README on github for how to use it.

関連の質問