Dataswyft API Platform: Developers Docs
WebsiteGitHubSlackLogin
  • About Dataswyft
    • Community & Support
  • Learn about Dataswyft Platform
    • Decentralized Data Servers
    • Personal Data Account
      • HMIC Permissions
      • Namespaces
      • Single Sign-On
    • Data Wallet
      • Data Wallet Canvas and Solutions
      • CheckD Data Wallet: Release Notes
    • Dataswyft One
      • Compute Tools
  • Build on Dataswyft Platform
    • Dataswyft One APIs
      • Data API
        • Filtering, Querying & Transforming Data
        • Data Debit
      • File Storage API
      • Computations API
      • Postman Collection
    • Integrating with Data Wallets
    • Getting Started
      • Quick Start
      • Developers Portal
        • Updating and Submitting an Application
        • Deleting an Application
        • Application Statuses
      • Application Example - React
        • 1. Environment Setup
        • 2. Create Main Structure
        • 3. Main Page & Routing
        • 4. User Authentication
        • 6. CRUD Operations
        • 5. Component Pages
  • Deploy
    • Application Review
    • Rating Assurance & Certification
    • Live Application Ratings
  • Knowledge Base
    • Security Practices
    • FAQ
    • Glossary of Terms
  • Dataswyft
Powered by GitBook
On this page

Was this helpful?

  1. Build on Dataswyft Platform
  2. Advanced Topics
  3. User Journeys
  4. Password Management
  5. Guides
  6. JavaScript

2. Fetch Applications, Data Plugs and Data Debits

Applications

Get all the apps

The are 2 ways to fetch applications:

  1. With default options.

Example:

try {
    const result = await hat.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"

const options = {
    ordering: "descending",
    orderBy: "name"
};

try {
    const result = await hat.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 {
    const result = await hat.applications().getById("testhatapp");

    if (result.parsedBody) {
        // result.parsedBody contains the application.
    }
} catch (error) {
    // The request failed...
}

Get an application status

Parameters

Type

application

Example:

const status = 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:

const redirectUrl = "https://myapp.dataswift.io/app/redirect";
const fallbackUrl = "https://myapp.dataswift.io/app/fallback";
const generatedUrl = 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.

Last updated 3 years ago

Was this helpful?

HatApplication
HatApplication