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...}
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/redirect
window.location.href = generatedUrl; // Navigate the user to setup the Data Plug.