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
  • Overview
  • Setting Up Environment
  • Supported Environments
  • Installation
  • Usage

Was this helpful?

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

JavaScript

Last updated 3 years ago

Was this helpful?

Overview

This library contains all the API calls needed to communicate with the HAT.

  • Authentication

  • Fetch Applications, Data Plugs and Data Debits

  • Read and write data to endpoints

  • File API

Setting Up Environment

Supported Environments

The @dataswift/hat-js library works in all modern browsers. Some older browsers do not support all the features required. If you want to support these browsers you need to load polyfill for .

Installation

Install the @dataswift/hat-js package via or pull from our CDN.

NPM installation

npm install @dataswift/hat-js

CDN Link

<script src="https://cdn.dataswift.io/libs/hatjs/hat-0.3.0.min.js"></script>

Usage

Importing

ES6

import { HatClient } from "@dataswift/hat-js";

ES5 Modules

var HatClient = require("@dataswift/hat-js").HatClient;

Initialisation

Configuration type:

interface HatClientConfig {
    apiVersion?: string; // Api Version for the HAT. eg. v2.6
    hatDomain?: string; // The HAT domain of the user. eg. testing.hubat.net
    token?: string; // The Application token.
    secure?: boolean; // If you want to run the HAT locally, you have to modify this field to 'false'.
    onTokenChange?: Function;
}

Example:

const config = {
    token: "<access-token>",
    apiVersion: 'v2.6',
    secure: true,
    onTokenChange: (newToken) => storeNewToken(newToken)
};

const hat = new HatClient(config);

Promise
npm