try {constresult=awaithat.applications().getAllDefault();if (result.parsedBody) {// result.parsedBody contains an array of Applications. }} catch (error) {// The request failed...}
2. With custom options.
Example:
// In custom options you can specify the following parameters: "ordering", "orderBy", "take", "skip"constoptions= { ordering:"descending", orderBy:"name"};try {constresult=awaithat.applications().getAll(options);if (result.parsedBody) {// result.parsedBody contains an array of Applications. }} catch (error) {// The request failed...}
Get an application with a specific ID
Example:
try {constresult=awaithat.applications().getById("testhatapp");if (result.parsedBody) {// result.parsedBody contains the application. }} catch (error) {// The request failed...}
Get an application status
Parameters
Type
application
Example:
conststatus=hat.applications().getAppStatus(application);console.log(status);// Will print one of 'goto' | 'running' | 'fetching' | 'failing' | 'untouched' | 'update';
Generate a Data Plug setup URL
You can generate a URL to redirect the user to setup a Data Plug.
Parameters
Type
application
redirect
string
fallback
string
Example:
constredirectUrl="https://myapp.dataswift.io/app/redirect";constfallbackUrl="https://myapp.dataswift.io/app/fallback";constgeneratedUrl=hat.applications().getSetupUrl(application, redirectUrl, fallbackUrl);console.log(generatedUrl); // Will print: https://testing.hubat.net/#/hatlogin?name=facebook&fallback=https://myapp.dataswift.io/app/fallback&redirect=https://facebook.hubofallthings.com%3Fredirect=https://myapp.dataswift.io/app/redirectwindow.location.href = generatedUrl; // Navigate the user to setup the Data Plug.