Scalefusion Developer API
  • 25 Sep 2023
  • 5 読む分
  • PDF

Scalefusion Developer API

  • PDF

The content is currently unavailable in Ja - 日本語. You are viewing the default English version.
記事の要約

We at Scalefusion realize that an enterprise might be using other ITSM software and/or internal applications that need quick and direct access to their managed device inventory and, in some cases, perform actions on the managed devices. This ensures that the IT Team does not have to switch the context explicitly from the internal application to the Scalefusion Dashboard to perform tasks.

To address this requirement, Scalefusion provides a Developer API that can be integrated into your internal applications and perform device management operations. This document guides you on how to enable the Developer API and how to use the API Explorer with some examples and some frequently asked questions.

Before you Begin

  • Ensure that you have a valid Scalefusion account with permission to view Developer API.
  • To test the APIs (the examples shown here), you need to have,
    • A Device managed by Scalefusion
    • Have at least one Device Profile
    • Have at least one Device Group

Step 1: Generating the API Key

The first step is to generate the Developer API Key that is used to authorize the API calls from your applications. To do so,

  1. Login to Scalefusion Dashboard and navigate to Integrations > Developer API
  2. Click on Generate API Key to generate a new API Key. This will generate the API Key that you can use with your applications.
  3. You need to Copy/Paste the API Key and share it with your application developer to use it in the application. You will also need the key to use the Scalefusion API Explorer.
NOTE: The API key should be secured from unauthorized access. You can regenerate if it gets compromised, which will automatically disable the old key.

Step 2: Testing the API Key using Scalefusion API Explorer

Now that you have the API Key, you can use the API Explorer to test the key and try out APIs. We have given some examples below, but feel free to try out other APIs as well.

  1. Click on READ API DOCS to launch the API Explorer,
  2. The first step in the API Explorer is to paste the API Key that you generated in Step 1.
  3. Global options for API Explorer are,
    1. Show/Hide: Show or hide the API section
    2. List Operations: Lists the HTTP operations that can be performed on this API
    3. Expand Operations: Opens up the expanded view of the API console so that you can try all the APIs.

Example: Getting the Device ID(s)

This is the precursor to most APIs, which gives you the IDs of the managed devices that can be used in other APIs. To try this,

  1. Click on the Devices API title to expand the Devices API. Click on the Try it out button.
    1. page: Leave this parameter blank to get all the devices.
    2. Sample Output: This returns the device information such as name, battery, status, IMEI etc. You can obtain and cache the id parameter for further use.

Example: Getting the Last 10 Locations

  1. Click on the Locations API to expand it. Enter/Paste a device ID that you obtained previously. Click Try it Out.
    1. Sample Output: The last 10 locations are printed.

Example: Getting Device Profile ID(s)

  1. To get your Profile IDs, click on device_profiles.json API, located under the device_profiles section and click on Try it out 
    1. Sample Output: This provides the ID as well as the name of every device profile in your account. You can cache these device profile IDs when using the APIs related to Device Profiles.

Example: Getting Device Group ID(s)

  1. To get your Group IDs, click on device_groups.json API, located under the device_groups section and click on Try it out
    1. Sample Output: This provides the Device Group ID (beside “id”), the name of the group, and the ID of any Device Profile that is associated with that group. You can cache these device group IDs when using the APIs related to Device Groups.

Example: Removing Devices from a Device Profile

  1. To remove a device from a profile, expand the remove_from_device.jsonAPI and enter the additional parameters,
    1. id: Enter the Device Profile Id.
    2. device_ID: Enter the device ID of the device that you want to remove from the profile.
    3. Click Try it out
    4. Sample Output: Upon a successful command, you should receive a status of success, as well as a 200 response code (HTTP response for success). If you view the device on the Dashboard, you will see that it no longer has a device profile!

Frequently Asked Questions

Question: Can we prevent our Admins from accessing this developer API Key?

Answer: Yes. Navigate to Admins and Roles and edit the hide the Visibility of Developer API.

Question: Why do we get an error, "Access to API has been blocked by CORS policy"?

Answer: The APIs cannot be called from the Browser directly as we have restricted access. The API request has to be routed through a backend server, or you can use CURL. Also, we advise against using the API key directly in JavaScript as it is insecure and can be accessed by anyone.

Question: Are there any Rate Limits to the number of API calls that we can make?

Answer: Yes. The APIs are rate-limited, and you are allowed to make 30 API requests per minute and/or 43200 API requests per 24 hours. If the API calls exceed the provided limits, then the callers will get HTTP error 429.

List of APIs

We recommend using the API Explorer at https://app.scalefusion.com/api-docs for a complete and latest list of supported APIs. Here is a list of important APIs.

API Endpoint
Category
Description
/api/v1/devices.json
Devices
The basic API to get the list of managed Devices and their IDs. The IDs are used in most of the other APIs to manage.
/api/v1/devices/{id}/battery.json
Devices
Gets the Battery Information of one Device based on the ID.
/api/v1/devices/{id}/send_alarm.json
Devices
Send Buzz to an Android or iOS-managed device.
This feature does not work on iOS, starting from OS13 onwards.
/api/v1/devices/{id}/reboot.json
Devices
Send a Reboot command to the managed device. This works only on the supported devices.
/api/v1/devices/{id}/monthly_data_usage.json
Devices
Get the Monthly Data Usage of an Android or iOS device.
/api/v1/devices/{id}/update_exit_passcode.json
Devices
Update the Exit passcode of a single device that does not have any Device Profile.
/api/v1/devices/{id}/change_group.json
Devices
Move the device to a new group.
/api/v1/devices/{id}/assign_group.json
Devices
Assign a Device group to a device.
/api/v1/devices/broadcast_message.json
Devices
Send a broadcast message to the Android or iOS device.
/api/v1/devices/lock.json
Devices
Send a Lock command that will apply the policies on the device.
/api/v1/devices/unlock.json
Devices
Send an Unlock command that will relax the policies on the device.
/api/v1/devices/search.json
Devices
Search your device inventory using IMEI or Serial Number.
/api/v1/devices/clear_app_data.json
Devices
Send a command to Clear Application Data.
/api/v1/devices/{id}.json
Devices
Get complete information about a Device.
/api/v1/devices/{device_id}/locations.json
Devices
Fetch the latest 10 locations of the managed devices.
/api/v1/devices/{device_id}/browser_shortcuts.json
Devices
Fetch the browser shortcuts enabled on the device.
/api/v1/devices/{device_id}/device_apps/enabled_apps.json
Devices
Fetch the applications that the user is allowed to use.
/api/v1/devices/{device_id}/device_apps/registered_apps.json
Devices
Fetch the applications that are installed on the device.
/api/v1/device_profiles.json
Device Profile
Get a List of all the Device Profiles in the account.
/api/v1/device_profiles/{id}/apply_to_device.json
Device Profile
Apply the Device Profile to the device.
The profile is applied on one device at a time
/api/v1/device_profiles/{id}/remove_from_device.json
Device Profile
Remove the Device Profile from the device.
/api/v1/device_groups.json
Device Group
Get a List of all the Device Groups.
/api/v1/device_groups/{id}/remove_device.json
Device Group
Remove a Device from the Group.
/api/v1/device_groups/{id}/lock_devices.json
Device Group
Lock (apply policies) on all the devices in a group.
/api/v1/device_groups/{id}/unlock_devices.json
Device Group
Unlock (relax policies) on all the devices in a group.
/api/v1/device_groups/{id}/enroll_device.json
Device Group
Add a Device to a Device Group.
/api/v1/device_groups/{id}.json
Device Group
Supports DELETE and PATCH methods to delete the group and update the device profile of the group.

この記事は役に立ちましたか?

What's Next