5. Data Plugs

Data Plugs

In the PDA ecosystem, Data Plug is a minimal API-to-API web service with the primary purpose of fetching data from third party API and pushing it to the user's PDA. Due to the security considerations and limited scope of required functionality, each data plug is granted a write-only access to any particular PDA.

Fetch Data Plugs and Applications

HAT for iOS provides an API call for you to fetch all the available Data Plugs:

HATExternalAppsService.getExternalApps(
            userToken: userToken,
            userDomain: userDomain,
            completion: availablePlugsReceived,
            failCallBack: errorRetrievingDataPlugs)

As you may have noticed, the function name is getExternalApps. Applications and Data Plugs are not only represented by the same structure but they have the same API as well.

  • userToken is the user's token to authenticate with the PDA.

  • userDomain is the user's PDA address used to form the url to fetch the Data Plugs.

  • completion is a callback that is called when the request was successful. It has type of @escaping (([HATApplicationObject], String?) -> Void).

    The first parameter is an array of HATApplicationObject. This is the structure of Data Plugs and Applications. More on that in the next section.

    This array contains all the Data Plugs and Applications on the PDA. The second parameter is an optional String, the refreshed user token that the PDA returns.

  • failCallBack is a callback that is called when the request has failed. The type of the function is @escaping ((HATTableError) -> Void). HATTableError is a custom object describing the errors that have occurred during the querying of the tables in the database.

A successful response will have statusCode 200 and look like this:

[
    {
        "application": {
            "id": "hatapp",
            "kind": {
                "url": "https://rumpel.hubofallthings.com",
                "iosUrl": "https://itunes.apple.com/app/id1303181222?mt=8",
                "kind": "App"
            },
            "info": {
                "version": "1.2.5",
                "updateNotes": {
                    "header": "We’ve made some improvements to the user experience and made clear your legal rights over your data so that you can access new services on your HAT app. Please accept our updated [terms of service](https://hatdex.org/terms-of-service-hat-owner-agreement) and [privacy policy](https://hatdex.org/privacy-notice-hat-owner-services-and-hat-accounts) to continue using HAT.",
                    "notes": [
                        "We made clear the difference between “your data” in your HAT microserver and “HATDeX account data” which we need to create your HAT microserver",
                        "We made clear the relationship between HAT permissions and instructions that you control within the HAT versus HATDeX platform services and third party services that others control (when you give permission) to help you easily view, manage and organise the data within the HAT",
                        "We made clear the way data debits and data plugs operate based on the permissions and instructions you control and the services we control to execute your instructions",
                        "We updated the way we use your information for HATDeX account data in accordance with GDPR",
                        "We updated the way apps, plugs and tools are rated to give HAT owners full transparency on services and apps \"Powered by HAT\". Find more info [here](https://www.hatcommunity.org/hat-dex-rating)"
                    ]
                },
                "published": true,
                "name": "HAT App",
                "headline": "The HAT Dashboard",
                "description": {
                    "text": "\n Your digital life is made up of hundreds of day to day interactions on the Internet: liking and sharing content, booking train tickets, tracking your activity. It's time to see them all come together, in one place, so you can benefit from analysis, insights and self-discovery on your personal data.\n\n CONNECT DATA PLUGS\n Link your Twitter, Facebook, Spotify, FitBit, Google Calendar and iPhone GPS locations to your HAT, and pull in all that data in real time. Your data is kept in an entirely private space, owned by you – we don't see it, third parties don't see it, no-one sees it but you.\n\n YOUR DIGITAL LIFE\n View your data in a live feed where you can experience and engage with it as it arrives into your HAT. Facebook posts, workouts recorded by FitBit, photos you've shared – see it all in one integrated feed. Search your data by date range to know exactly where you were and what digital actions you took at any given time.\n\n PUBLIC PROFILE\n Save your personal information privately, and customise exactly which parts you want to share publicly on your Personal HAT Address – your own public URL. Think of it as the front door to your HAT, and use it to display the information you'd like.\n\n ME, MYSELF AND AI\n We will be releasing the Smart HAT Engine (SHE) soon – this engine on your HAT will enable you to subscribe to different types of analytics and machine learning functions to give you daily insights and help you make better decisions with your data, completely in your private space. Start claiming your data for yourself so that you can better use AI in your life.\n\n One HAT, so many possibilities: our HAT Community of startups and app makers is creating a new generation of Internet applications sitting on your HAT. With all the data in the account, you can donate your data to research, spend it, match it and exchange it for services. Join the community to be part of the movement to change the Internet at https://hatcommunity.org\n\n          ",
                    "markdown": "\n Your digital life is made up of hundreds of day to day interactions on the Internet: liking and sharing content, booking train tickets, tracking your activity. It's time to see them all come together, in one place, so you can benefit from analysis, insights and self-discovery on your personal data.\n\n ### Connect Data Plugs\n\n Link your Twitter, Facebook, Spotify, FitBit, Google Calendar and iPhone GPS locations to your HAT, and pull in all that data in real time. Your data is kept in an entirely private space, owned by you – we don't see it, third parties don't see it, no-one sees it but you.\n\n ### Your Digital Life\n\n View your data in a live feed where you can experience and engage with it as it arrives into your HAT. Facebook posts, workouts recorded by FitBit, photos you've shared – see it all in one integrated feed. Search your data by date range to know exactly where you were and what digital actions you took at any given time.\n\n ### Public Profile\n\n Save your personal information privately, and customise exactly which parts you want to share publicly on your Personal HAT Address – your own public URL. Think of it as the front door to your HAT, and use it to display the information you'd like.\n\n ### Me, Myself and AI\n\n We will be releasing the Smart HAT Engine (SHE) soon – this engine on your HAT will enable you to subscribe to different types of analytics and machine learning functions to give you daily insights and help you make better decisions with your data, completely in your private space. Start claiming your data for yourself so that you can better use AI in your life.\n\n One HAT, so many possibilities: Our HAT Community of startups and app makers is creating a new generation of Internet applications sitting on your HAT. With all the data in the account, you can donate your data to research, spend it, match it and exchange it for services. Join the community to be part of the movement to change the Internet at https://hatcommunity.org\n                                ",
                    "html": "\n <p>Your digital life is made up of hundreds of day to day interactions on the Internet: liking and sharing content, booking train tickets, tracking your activity. It's time to see them all come together, in one place, so you can benefit from analysis, insights and self-discovery on your personal data.</p>\n\n <h3>Connect Data Plugs</h3>\n\n <p>Link your Twitter, Facebook, Spotify, FitBit, Google Calendar and iPhone GPS locations to your HAT, and pull in all that data in real time. Your data is kept in an entirely private space, owned by you – we don't see it, third parties don't see it, no-one sees it but you.</p>\n\n <h3>Your Digital Life</h3>\n\n <p>View your data in a live feed where you can experience and engage with it as it arrives into your HAT. Facebook posts, workouts recorded by FitBit, photos you've shared – see it all in one integrated feed. Search your data by date range to know exactly where you were and what digital actions you took at any given time.</p>\n\n <h3>Public Profile</h3>\n\n <p>Save your personal information privately, and customise exactly which parts you want to share publicly on your Personal HAT Address – your own public URL. Think of it as the front door to your HAT, and use it to display the information you'd like.</p>\n\n <h3>Me, Myself and AI</h3>\n\n <p>We will be releasing the Smart HAT Engine (SHE) soon – this engine on your HAT will enable you to subscribe to different types of analytics and machine learning functions to give you daily insights and help you make better decisions with your data, completely in your private space. Start claiming your data for yourself so that you can better use AI in your life.</p>\n\n <p>One HAT, so many possibilities: Our HAT Community of startups and app makers is creating a new generation of Internet applications sitting on your HAT. With all the data in the account, you can donate your data to research, spend it, match it and exchange it for services. Join the community to be part of the movement to change the Internet at https://hatcommunity.org</p>\n                                                       "
                },
                "termsUrl": "https://hatdex.org/terms-of-service-hat-owner-agreement-2018-10-01",
                "dataUsePurpose": "The HAT App only uses your data to display it back to you. It does not share your data with any third-parties or store it outside of your personal HAT.",
                "supportContact": "contact@dataswyft.com",
                "rating": {
                    "score": "Z***"
                },
                "dataPreview": [
                    {
                        "source": "she",
                        "date": {
                            "iso": "2018-10-31T08:54:26.303Z",
                            "unix": 1540976066
                        },
                        "types": [
                            "note"
                        ],
                        "title": {
                            "text": "HAT Private Micro-server created"
                        },
                        "content": {
                            "text": "Digital Citizenship on the Internet is about the freedom of having our own persona(s) with the data we are able to claim, control and share. You now have a HAT micro-server to do that. Congratulations!"
                        }
                    }
                ],
                "graphics": {
                    "banner": {
                        "normal": ""
                    },
                    "logo": {
                        "normal": "https://static1.squarespace.com/static/5a71ebc8b1ffb68777ca627a/t/5acb4a166d2a73d3a00a10c6/1523272220659/HATAppsstore-rounded.png?format=300w"
                    },
                    "screenshots": [
                        {
                            "normal": "https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/cb/01/56/cb0156b7-0cb6-128c-b1ec-fc3c7b31eb87/mzl.xfaethox.png/300x0w.jpg",
                            "large": "https://is5-ssl.mzstatic.com/image/thumb/Purple128/v4/ac/a2/6b/aca26bb8-39dd-1cd9-159d-d37012ffbfeb/mzl.jiaxtegz.png/643x0w.jpg"
                        },
                        {
                            "normal": "https://is4-ssl.mzstatic.com/image/thumb/Purple118/v4/26/b7/0f/26b70ffa-d9bc-2520-582b-b9a436eb00f5/pr_source.png/300x0w.jpg",
                            "large": "https://is4-ssl.mzstatic.com/image/thumb/Purple128/v4/9b/2f/68/9b2f6853-ce11-a189-ae41-445e8e7b3248/mzl.fkcehkpp.png/643x0w.jpg"
                        },
                        {
                            "normal": "https://is4-ssl.mzstatic.com/image/thumb/Purple128/v4/10/df/8f/10df8fae-b2b7-0c93-c530-d6338b1e6bc8/pr_source.png/300x0w.jpg",
                            "large": "https://is4-ssl.mzstatic.com/image/thumb/Purple118/v4/28/de/7a/28de7aeb-54ed-6692-a63a-8102703361e2/pr_source.png/643x0w.png"
                        },
                        {
                            "normal": "https://is5-ssl.mzstatic.com/image/thumb/Purple128/v4/15/94/30/159430c6-99fc-ee9f-72aa-d46d8436d76c/mzl.dvmpzlje.png/300x0w.jpg",
                            "large": "https://is2-ssl.mzstatic.com/image/thumb/Purple118/v4/11/df/40/11df4050-582a-7598-fe02-b4421a4be818/pr_source.png/643x0w.png"
                        }
                    ]
                }
            },
            "developer": {
                "id": "hatdex",
                "name": "Dataswyft Ltd",
                "url": "https://hatdex.org",
                "country": "United Kingdom"
            },
            "permissions": {
                "rolesGranted": [
                    {
                        "role": "owner"
                    },
                    {
                        "role": "applicationlist"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "hatappstaging"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "notables"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "twitter"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "facebook"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "fitbit"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "spotify"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "instagram"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "monzo"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "fitbit"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "google-calendar"
                    },
                    {
                        "role": "applicationmanage",
                        "detail": "starling"
                    }
                ]
            },
            "setup": {
                "url": "https://rumpel.hubofallthings.com",
                "iosUrl": "hatapp://hatapphost",
                "kind": "External"
            },
            "status": {
                "compatibility": "1.2.5",
                "dataPreviewEndpoint": "she/feed",
                "recentDataCheckEndpoint": "rumpel/locations/ios",
                "versionReleaseDate": "2018-07-23T12:00:00.000Z",
                "kind": "Internal"
            }
        },
        "setup": true,
        "enabled": true,
        "active": true,
        "needsUpdating": true,
        "mostRecentData": "2018-11-12T08:27:57.609Z"
    }
  ]
  • application holds the most parts of the structure. It consists of the following 7 values:

  1. id in the application part of the JSON is the id of the Data Plug in the HAT.

    1. kind in the application part of the JSON has 4 values holding the various urls and the type of the Data Plug:

      1. url is the url of the Data Plug or Application to use in web

      2. iosUrl is the iTunes url of the Application in the App Store. It's optional and only there for Application type

      3. androidUrl is the Play Store url of the Application in the Play Store. It's optional and only there for Application type

      4. kind is the kind. As we mentioned earlier Data Plug and Application is represented by the same structure and use the same APIs

        • Therefore, the kind can be App or Data Plug. When for example you want only the Applications then simply you are going to filter the array based on the kind.

  2. info in the application part of the JSON has 12 values:

    1. version is the version number of the app in the HAT. This may be different from the version number of the Application in the App Store or Play Store

    2. updateNotes is essentially the release notes for the latest version. It is formed by the header, the title of the release notes, and the notes an array of String to easily show the notes as an unordered list.

    3. published indicates if the app is published or not. It can be that the app is not yet published, so it's not yet live, and it's testing, beta, app

    4. name is the official name of the app

    5. headline is the headline or subtitle of the app. It can be placed underneath the name for example, to provide more context for the app if needed.

    6. description allows you to describe your app better with a longer text. Also, it has support for different formats of text,text, markdown and html. markdown and html are optional.

    7. termsUrl is a URL of the terms and conditions. Users must be able to read them if they wish.

    8. dataUsePurpose is a text explaining why and how the app will use the data

    9. supportContact a support email. Users will use this email to contact you.

    10. rating is an optional object formed by score which describes the permissions and the data use using a letter-based scoring system. You can read more here.

    11. dataPreview is actually an array of SheFeed structures. This is used to preview items, if any, instead of making another network request to fetch those items. The array can be empty.

  3. graphics is a structure formed by 3 values:

    1. banner is the URL of the banner image

    2. logo is the URL of the app logo image

    3. screenshots is the URL of the app's screenshots used to showcase what this app offers.

      • All the above 3 values use the same structure. PDA images can be categorised as small, normal, large and xlarge.

      • Except normal all are optional values.

  4. developer consists of some basic info about the developer. This includes: id, name, url and country.

  5. permissions includes 3 values:

    1. rolesGranted which is an array of role and detail, optional, describing the roles granted in the Application.

    2. dataRetrieved which is a type of DataOfferRequiredDataDefinitionObjectV2. It describes the data that the Application will retrieve. optional.

      1. rolling describes if the data have a rolling start date

      2. bundle You can read more about it here

      3. startDate the start date of the bundle. optional

      4. endDate the end date of the bundle. optional

    3. dataRequired which is a type of HATExternalAppsDataRequiredObject. optional

  6. setup encapsulates all the urls that the Application needs in order to setup. The structure is the same as kind but the urls can be different

  7. status provides some info about the status of the application:

    1. compatibility – the last version that is compatible with the current one

    2. versionReleaseDate – the date, in ISO format, of the latest release

    3. kind – the kind of the release. It can be either Internal or External.

    4. recentDataCheckEndpoint –  a URL pointing on the most recent data point. optional

    5. statusUrl –  a URL to check the status of the Application or Data Plug. optional

    6. expectedStatus – the expected status number. optional

    7. dataPreviewEndpoint – a URL pointing to the actual data on the PDA to show them as a preview. optional

  • setup Boolean value indicating if this app has been setup successfully

  • enabled Boolean value indicating if this app has been enabled successfully

  • active Boolean value indicating if this app is currently active or not

  • needsUpdating Boolean value indicating if this app needs updating. An Application may need an update in case the terms

    have changed or a new version has been released.

A request that has failed will look like this:

{
  "error": "Not Authenticated",
  "message": "Not Authenticated"
}
  • error is the error that has occurred

  • message is a more descriptive message about the error that has occurred

Set up an Application

Setting up an application is similar to the login process. First you have to check the kind; is it App, or Data Plug. The 2 of them are different in how you set them up.

In the case of an App you first have to check if the app is already installed on the user's device. To do that you have to check with:

UIApplication.shared.canOpenURL(appURL)

where appURL is the iosUrl from the Application -> setup. If user has the app installed, then you have to form a URL like this:

"https://\(hatAddress)/#/hatlogin?name=\(appID)&redirect=\(appURL)&fallback=\(fallback)"
  • hatAddress is the (fully qualified domain) address of the PDA, e.g. postman.hubat.net

  • appID is the id of the application to setup.

  • appURL is the URL where the user should be sent to after completing authentication. In this case it is the iosURL.

  • fallback is the URL where the user should be sent to in case the authentication has failed. Optional. For an iOSapplication that would probably be: \(applicationName)://failed and has to be added in the info.plist file of the project in Xcode as a known URL.

As you may have noticed this is exactly the same URL as the login URL and there is a reason for this. The setup process goes through web. Just like during the login process, the user will be asked to insert their password before continuing to the next step. The next step is accepting the terms and conditions and giving the permissions the app requires to function. After that if everything goes smoothly, PDA will redirect back to the success redirect. The redirect url will now include a parameter which is the token for the particular app. iOS will ask the user if they want to launch the particular app. If the user selects "yes" then the app will be launched. If there is a problem, DA will redirect to the fallback url and you have to hide Safari and show a message that something went wrong.

If you don't know how to handle SFSafariViewController you can read more here.

If the user does not have the app installed, you first have to redirect them to the App Store in order for them to download the app. The URL that you have to use the url in Application -> kind. Again the only thing you have to do is open it using Safari. When the user has installed the app they may then tap again to set up the Application.

Set up Data Plug

Setting up a Data Plug is a lot simpler than setting up an Application. You just open the url in Application -> kind with safari and follow the instructions. Again, the user will first have to enter the password. After that each Data Plug has a different way of asking permissions and registering with the PDA.

State of the Application and Data Plug

Application and Data Plug can be in multiple states. Setup, failing, need updating, disabled. To respond in state changes you can use the following snippet:

/**
     Returns a ApplicationConnectionState according to the application state

     — parameter application: The application to check the state of

     — returns: An ApplicationConnectionState case depending in the status of the app
     */
    static func getState(application: HATApplicationObject) -> ApplicationConnectionState {

        if application.setup && (application.needsUpdating ?? false) {

            return .needsUpdating
        } else if application.enabled && !application.active {

            return .failing
        } else if application.enabled && application.active {

            if application.mostRecentData == nil && application.application.kind.kind != "App" {

                return .fetching
            }

            return .connected
        }

        return .notConnected
    }
  • connected is the case when the Application or Data Plug is enabled, active and it doesn't needsUpdating.

  • fetching is the case when the Application or Data Plug is enabled, active, it's an App and the mostRecentData is nil. This means that no data have been saved in the PDA yet.

  • needsUpdating is the case when the Application or Data Plug is marked as needsUpdating in the API response. This means the user has to go through the setup process again.

  • failing is the case when there is a problem in the Application or Data Plug. Setting up again might or might not help. In case this persists please do contact us.

  • notConnected is the case when the Application or Data Plug has never been set up before.

Disable Data Plug or Application

You can also disable a Data Plug or an Application. To do that you can call the next function:

HATExternalAppsService.disableApplication(
      appID: selectedApp.application.id,
      userDomain: hatAddress,
      userToken: userToken,
      completion: appDisabled,
      failCallBack: errorDisablingApp)
  • appID is the id, in Application structure, of the Application or Data Plug

  • userDomain is the user's PDA address used to form the url to disable the Data Plug or Application

  • userToken is the user's token used to authenticate with the PDA

  • completion is a callback function that is called when the request is successful with a type of @escaping @escaping ((HATApplicationObject, String?) -> Void). The first parameter is the disabled HATApplicationObject. The second parameter is an optional String, the refreshed user token that the PDA returns.

  • failCallBack is a callback that is called when the request has failed. The type of the function is @escaping ((HATTableError) -> Void). HATTableError is a custom object describing the errors that have occurred during the querying of the tables in the database.

A successful response will have statusCode 201 and look like this:

{
    "application": {
        "id": "hatapp",
        "kind": {
            "url": "https://rumpel.hubofallthings.com",
            "iosUrl": "https://itunes.apple.com/app/id1303181222?mt=8",
            "kind": "App"
        },
        "info": {
            "version": "1.2.5",
            "updateNotes": {
                "header": "We’ve made some improvements to the user experience and made clear your legal rights over your data so that you can access new services on your HAT app. Please accept our updated [terms of service](https://hatdex.org/terms-of-service-hat-owner-agreement) and [privacy policy](https://hatdex.org/privacy-notice-hat-owner-services-and-hat-accounts) to continue using HAT.",
                "notes": [
                    "We made clear the difference between “your data” in your HAT microserver and “HATDeX account data” which we need to create your HAT microserver",
                    "We made clear the relationship between HAT permissions and instructions that you control within the HAT versus HATDeX platform services and third party services that others control (when you give permission) to help you easily view, manage and organise the data within the HAT",
                    "We made clear the way data debits and data plugs operate based on the permissions and instructions you control and the services we control to execute your instructions",
                    "We updated the way we use your information for HATDeX account data in accordance with GDPR",
                    "We updated the way apps, plugs and tools are rated to give HAT owners full transparency on services and apps \"Powered by HAT\". Find more info [here](https://www.hatcommunity.org/hat-dex-rating)"
                ]
            },
            "published": true,
            "name": "HAT App",
            "headline": "The HAT Dashboard",
            "description": {
                "text": "\n Your digital life is made up of hundreds of day to day interactions on the Internet: liking and sharing content, booking train tickets, tracking your activity. It's time to see them all come together, in one place, so you can benefit from analysis, insights and self-discovery on your personal data.\n\n CONNECT DATA PLUGS\n Link your Twitter, Facebook, Spotify, FitBit, Google Calendar and iPhone GPS locations to your HAT, and pull in all that data in real time. Your data is kept in an entirely private space, owned by you – we don't see it, third parties don't see it, no-one sees it but you.\n\n YOUR DIGITAL LIFE\n View your data in a live feed where you can experience and engage with it as it arrives into your HAT. Facebook posts, workouts recorded by FitBit, photos you've shared – see it all in one integrated feed. Search your data by date range to know exactly where you were and what digital actions you took at any given time.\n\n PUBLIC PROFILE\n Save your personal information privately, and customise exactly which parts you want to share publicly on your Personal HAT Address – your own public URL. Think of it as the front door to your HAT, and use it to display the information you'd like.\n\n ME, MYSELF AND AI\n We will be releasing the Smart HAT Engine (SHE) soon – this engine on your HAT will enable you to subscribe to different types of analytics and machine learning functions to give you daily insights and help you make better decisions with your data, completely in your private space. Start claiming your data for yourself so that you can better use AI in your life.\n\n One HAT, so many possibilities: our HAT Community of startups and app makers is creating a new generation of Internet applications sitting on your HAT. With all the data in the account, you can donate your data to research, spend it, match it and exchange it for services. Join the community to be part of the movement to change the Internet at https://hatcommunity.org\n\n          ",
                "markdown": "\n Your digital life is made up of hundreds of day to day interactions on the Internet: liking and sharing content, booking train tickets, tracking your activity. It's time to see them all come together, in one place, so you can benefit from analysis, insights and self-discovery on your personal data.\n\n ### Connect Data Plugs\n\n Link your Twitter, Facebook, Spotify, FitBit, Google Calendar and iPhone GPS locations to your HAT, and pull in all that data in real time. Your data is kept in an entirely private space, owned by you – we don't see it, third parties don't see it, no-one sees it but you.\n\n ### Your Digital Life\n\n View your data in a live feed where you can experience and engage with it as it arrives into your HAT. Facebook posts, workouts recorded by FitBit, photos you've shared – see it all in one integrated feed. Search your data by date range to know exactly where you were and what digital actions you took at any given time.\n\n ### Public Profile\n\n Save your personal information privately, and customise exactly which parts you want to share publicly on your Personal HAT Address – your own public URL. Think of it as the front door to your HAT, and use it to display the information you'd like.\n\n ### Me, Myself and AI\n\n We will be releasing the Smart HAT Engine (SHE) soon – this engine on your HAT will enable you to subscribe to different types of analytics and machine learning functions to give you daily insights and help you make better decisions with your data, completely in your private space. Start claiming your data for yourself so that you can better use AI in your life.\n\n One HAT, so many possibilities: Our HAT Community of startups and app makers is creating a new generation of Internet applications sitting on your HAT. With all the data in the account, you can donate your data to research, spend it, match it and exchange it for services. Join the community to be part of the movement to change the Internet at https://hatcommunity.org\n                                ",
                "html": "\n <p>Your digital life is made up of hundreds of day to day interactions on the Internet: liking and sharing content, booking train tickets, tracking your activity. It's time to see them all come together, in one place, so you can benefit from analysis, insights and self-discovery on your personal data.</p>\n\n <h3>Connect Data Plugs</h3>\n\n <p>Link your Twitter, Facebook, Spotify, FitBit, Google Calendar and iPhone GPS locations to your HAT, and pull in all that data in real time. Your data is kept in an entirely private space, owned by you – we don't see it, third parties don't see it, no-one sees it but you.</p>\n\n <h3>Your Digital Life</h3>\n\n <p>View your data in a live feed where you can experience and engage with it as it arrives into your HAT. Facebook posts, workouts recorded by FitBit, photos you've shared – see it all in one integrated feed. Search your data by date range to know exactly where you were and what digital actions you took at any given time.</p>\n\n <h3>Public Profile</h3>\n\n <p>Save your personal information privately, and customise exactly which parts you want to share publicly on your Personal HAT Address – your own public URL. Think of it as the front door to your HAT, and use it to display the information you'd like.</p>\n\n <h3>Me, Myself and AI</h3>\n\n <p>We will be releasing the Smart HAT Engine (SHE) soon – this engine on your HAT will enable you to subscribe to different types of analytics and machine learning functions to give you daily insights and help you make better decisions with your data, completely in your private space. Start claiming your data for yourself so that you can better use AI in your life.</p>\n\n <p>One HAT, so many possibilities: Our HAT Community of startups and app makers is creating a new generation of Internet applications sitting on your HAT. With all the data in the account, you can donate your data to research, spend it, match it and exchange it for services. Join the community to be part of the movement to change the Internet at https://hatcommunity.org</p>\n                                                       "
            },
            "termsUrl": "https://hatdex.org/terms-of-service-hat-owner-agreement-2018-10-01",
            "dataUsePurpose": "The HAT App only uses your data to display it back to you. It does not share your data with any third-parties or store it outside of your personal HAT.",
            "supportContact": "contact@dataswift.io",
            "rating": {
                "score": "Z***"
            },
            "dataPreview": [
                {
                    "source": "she",
                    "date": {
                        "iso": "2018-10-31T08:54:26.303Z",
                        "unix": 1540976066
                    },
                    "types": [
                        "note"
                    ],
                    "title": {
                        "text": "HAT Private Micro-server created"
                    },
                    "content": {
                        "text": "Digital Citizenship on the Internet is about the freedom of having our own persona(s) with the data we are able to claim, control and share. You now have a HAT micro-server to do that. Congratulations!"
                    }
                }
            ],
            "graphics": {
                "banner": {
                    "normal": ""
                },
                "logo": {
                    "normal": "https://static1.squarespace.com/static/5a71ebc8b1ffb68777ca627a/t/5acb4a166d2a73d3a00a10c6/1523272220659/HATAppsstore-rounded.png?format=300w"
                },
                "screenshots": [
                    {
                        "normal": "https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/cb/01/56/cb0156b7-0cb6-128c-b1ec-fc3c7b31eb87/mzl.xfaethox.png/300x0w.jpg",
                        "large": "https://is5-ssl.mzstatic.com/image/thumb/Purple128/v4/ac/a2/6b/aca26bb8-39dd-1cd9-159d-d37012ffbfeb/mzl.jiaxtegz.png/643x0w.jpg"
                    },
                    {
                        "normal": "https://is4-ssl.mzstatic.com/image/thumb/Purple118/v4/26/b7/0f/26b70ffa-d9bc-2520-582b-b9a436eb00f5/pr_source.png/300x0w.jpg",
                        "large": "https://is4-ssl.mzstatic.com/image/thumb/Purple128/v4/9b/2f/68/9b2f6853-ce11-a189-ae41-445e8e7b3248/mzl.fkcehkpp.png/643x0w.jpg"
                    },
                    {
                        "normal": "https://is4-ssl.mzstatic.com/image/thumb/Purple128/v4/10/df/8f/10df8fae-b2b7-0c93-c530-d6338b1e6bc8/pr_source.png/300x0w.jpg",
                        "large": "https://is4-ssl.mzstatic.com/image/thumb/Purple118/v4/28/de/7a/28de7aeb-54ed-6692-a63a-8102703361e2/pr_source.png/643x0w.png"
                    },
                    {
                        "normal": "https://is5-ssl.mzstatic.com/image/thumb/Purple128/v4/15/94/30/159430c6-99fc-ee9f-72aa-d46d8436d76c/mzl.dvmpzlje.png/300x0w.jpg",
                        "large": "https://is2-ssl.mzstatic.com/image/thumb/Purple118/v4/11/df/40/11df4050-582a-7598-fe02-b4421a4be818/pr_source.png/643x0w.png"
                    }
                ]
            }
        },
        "developer": {
            "id": "hatdex",
            "name": "Dataswift Ltd",
            "url": "https://hatdex.org",
            "country": "United Kingdom"
        },
        "permissions": {
            "rolesGranted": [
                {
                    "role": "owner"
                },
                {
                    "role": "applicationlist"
                },
                {
                    "role": "applicationmanage",
                    "detail": "hatappstaging"
                },
                {
                    "role": "applicationmanage",
                    "detail": "notables"
                },
                {
                    "role": "applicationmanage",
                    "detail": "twitter"
                },
                {
                    "role": "applicationmanage",
                    "detail": "facebook"
                },
                {
                    "role": "applicationmanage",
                    "detail": "fitbit"
                },
                {
                    "role": "applicationmanage",
                    "detail": "spotify"
                },
                {
                    "role": "applicationmanage",
                    "detail": "instagram"
                },
                {
                    "role": "applicationmanage",
                    "detail": "monzo"
                },
                {
                    "role": "applicationmanage",
                    "detail": "fitbit"
                },
                {
                    "role": "applicationmanage",
                    "detail": "google-calendar"
                },
                {
                    "role": "applicationmanage",
                    "detail": "starling"
                }
            ]
        },
        "setup": {
            "url": "https://rumpel.hubofallthings.com",
            "iosUrl": "hatapp://hatapphost",
            "kind": "External"
        },
        "status": {
            "compatibility": "1.2.5",
            "dataPreviewEndpoint": "she/feed",
            "recentDataCheckEndpoint": "rumpel/locations/ios",
            "versionReleaseDate": "2018-07-23T12:00:00.000Z",
            "kind": "Internal"
        }
    },
    "setup": true,
    "enabled": false,
    "active": true,
    "needsUpdating": true,
    "mostRecentData": "2018-11-12T08:27:57.609Z"
}

If you are not familiar with the structure you can read more here.

A request that has failed will look like this:

{
  "error": "Not Authenticated",
  "message": "Not Authenticated"
}
  • error is the error that has occurred

  • message is a more descriptive message about the error that has occurred

Last updated