Skip to content

Getting Started

About the API

The vablet API uses a JavaScript interface layer to facilitate in communicating with our application.

Using the API

Calling a native method

The vablet interface is primarily used calling the VabletNativeInterface.callNativeMethod(...) function.

This function expects the vablet function name as the first parameter, followed by an object containing the named arguments. The third argument is the returned callback function provided there is one.

Function

VabletNativeInterface.callNativeMethod(name, options, callback)
Argument Type Description
name string vablet API function name.
options object Named object containing function options.
callback function callback returns a response object.

Returns

Most vablet functions will return the results in the form of a callback function as the third argument, with the expected data attached to the response object.

Functions returning a callback will always contain a response object with success and error in the case of a failure.

Usage

Example

Below is a simple example on retrieving the file manifest data for a provided file id.

VabletNativeInterface.callNativeMethod(
  "getFileWithId",   // the vablet method name
  { fileId: 54321 }, // options for the vablet method
  (response) => {    // the callback provides a response object
    if (response.success) {
      // On success let's alert the file name!
      alert(response.file.name)
    } else {
      // Uh oh, We have an error! Let's see what it is.
      alert(response.error);
    }
  }
);

You can learn more about the getFileWithId(...) method here.

Conditions

The interface layer must be fully loaded before using any of the vablet native methods. To prevent any errors it's best to bind any events or functions calling the API in the VabletLibraryLoaded event.

Get more information about VabletLibaryLoaded here.

VabletFormTools

A collection of methods for capturing survey results and processing forms. VabletFormTools is a class with the methods listed below. Click on a class function to learn more about it's usage.

Class Functions

Class Function Description
bakePageFormAndSendAsPDF Creates and emails a PDF snapshot of the current page or form.
bakePageFormAndSaveToBox Create a PDF snapshot of the current page or form and upload it to Box.
sendFormAsSurvey Submits a form to vablet capture as a survey.

Linking in vablet

To open another vablet file or folder create an HTML link with an href to https://vabletgeneral/action?options using one of the link actions below.

Some link actions have optional parameters that can be passed in via query string.

Link Action Description
home Goes to the currently set home folder, normally root unless it has been customized.
openFile Opens a Vablet file by ID.
openFileName Opens a Vablet file by name.
openFileNameInPowerPoint Opens a Vablet file by name into PowerPoint.
openFolder Opens the specified folder in Vablet.
register Allows prefilling of the registration screen.
salesForceSessionStartWithEvent Starts a Salesforce session, with an existing event if provided uses an editing GUI when session ends
salesForceSessionStartWithEventNoEditing Starts a Salesforce session, with an existing event if provided, no GUI is used

To open an external link in a browser window outside of vablet use:

  • externalBrowserHttp:// for http
  • externalBrowserHttps:// for https

Global Settings

Optional global settings can be configured in VabletLoadSettings.json. This file must be placed into the root of the .zhtml file where the index.html should have been placed and not inside any subfolders. These settings apply to all the pages in the .zhtml file.

Example

Example content of VabletLoadSettings.json

  {
    "disableBounce":true,      // disable screen bounce
    "scaleToFitPage":true,     // scale to always fit screen size
    "disableStatusBar":true,   // disable Apple status bar
    "useTransparentBar":false, // disable Apple transparent bar
    "hideToolBar":true         // hide the vablet toolbar
  }

The above settings will disable screen bounce, scale to always fit the screen size, disable both the opaque and transparent Apple status bars, and hide the vablet toolbar.

List of Settings

Setting Description
disableBounce The default iOS bounce effect is disabled.
disableFileSwitchSwimlane Disables the Vablet Swimlane function.
disableStatusBar Disables the status bar at the top of the iDevice.
hideClose The bottom of the page contains a red close button. Setting this to true removes that button.
hideToolBar The bottom of the page contains a Vablet toolbar, when set to true that toolbar is disabled.
scaleToFitPage The webpage is automatically shrunk to fit into the view.
useTransparentBar The top of the page uses the default transparent bar rather than pushing down content.