Buzzy Documentation
  • Welcome to Buzzy
  • Getting Started with Buzzy
    • Getting Started Guide
      • 1. Starting with Buzzy AI
      • 2. The Buzzy Workspace
      • 3. Create a new app
      • 4. Preview and edit your app
      • 5. Manage your app
      • 6. Import your app to Figma
      • 7. Using Buzzy with Figma
      • 8. The Buzzy Figma plugin
      • 9. Creating a simple app
      • 10. Screens and navigation
      • 11. Forms, fields and data
      • 12. Data-driven menus & content
      • 13. Data edit and delete
      • 14. Search, sort and filter
      • 15. User login and registration
    • Buzzy AI or Figma first?
  • Working with Buzzy
    • Buzzy AI
      • About Buzzy AI
      • Kickstart with AI
      • Enhance with Figma
      • Extend with Code
      • Example prompts
      • Tips
      • Troubleshooting Buzzy AI
      • AI tokens and pricing
    • Buzzy for Figma
      • About Buzzy for Figma
      • Learning Figma
      • Creating a new app directly in Figma
        • Step by step version
      • Automarkup
      • Responsive layouts
      • Responsive layout checklist
      • Overflow and scrolling
      • Forms and fields
      • Images and galleries
      • Logging users in to your app
      • Theming
      • Troubleshooting Buzzy for Figma
      • Plugin error messages
    • Buzzy Deployment & App Stores
      • Setting up your custom Buzzy app
      • Connecting your own server
      • Apple & Google App Stores
    • Buzzy Marketplace
      • Buzzy Accreditation
    • Buzzy Project Guide
    • Buzzy App Examples
      • Buzzy Templates
      • AI-Powered Chat App
      • AI-Powered Custom T-Shirt App
      • AI-Powered Strategy App
      • AI-Powered Stock Portfolio App
      • Golf Course Finder
      • Personal Finance App with Figma AI
    • FAQs
  • The building blocks
    • Datatables, Fields & Data
      • Introduction to Fields
      • Basic Fields
        • Text
        • Number
        • Date
        • Location
        • Toggle
        • Checkboxes
        • Checklist
        • Selectlist
        • Rating
        • Attachments
        • Images
        • Signature
        • Audio Recording
        • Embedded Link
      • Advanced Fields
        • Formula
        • Sub tables
        • Linked Table field
        • Button
        • Teams
        • Payment
        • Notification
        • Event
        • User Vote
      • Display Fields
        • Header
        • Display Text
        • Image
        • Divider
      • Metadata Fields
        • Author Name
        • Author Phone
        • Submitted
      • Filter Controls
        • Viewers
        • Tags
        • Condition
      • External Fields
        • IBM Connections File
        • Box File
      • Sort Fields
      • Formulas
      • Datatable to Datatable Relationships
      • Security and Access Control
      • Displaying a field based on the values of other fields
      • Hiding a field based on role using a display formula
      • Importing data from a text file
      • Importing data from a URL
      • Import data from Datatable
      • Export data using Chrome
      • Export data in Browser
      • Export data using Safari
      • Datatable Field Type - Cheat Sheet
      • Troubleshooting Fields & Data
    • Code widget (custom code)
      • Code Widget Fields - Advanced Guide
      • New Async API + React HTML Components
      • Examples
        • Image Galley Slideshow
        • Ratings Average and Distribution
        • Event Locations Map
    • Analytics
  • Troubleshooting
    • App Error Codes
      • Action Error
      • App Not Found
      • Component Missing
      • Component Not Set
      • Component Settings Error
      • Datatable Not Found
      • Datatable Not Set
      • Field Not Found
      • Field Not Set
      • No App Selected
      • No Context Name
      • No Screens Found
      • Runtime Exception
      • Screen Not Found
      • Screen Not Set
    • Troubleshooting Buzzy AI
    • Troubleshooting Figma
  • REST API
    • Buzzy REST API
      • Integrating 3rd party applications
      • REST API
        • login
        • createappwithprompt
        • MicroApp Data Operations
          • microappdata
          • microappdata/row
          • insertmicroapprow
          • updatemicroapprow
          • removemicroapprow
          • microappchild
        • User & Organization Operations
          • userid
          • insertteammembers
          • teammembers
          • insertorganization
          • insertteam
        • enforceteammembership
      • Node.js API Client
      • Datatable Rules
      • Datatabledata Tutorial
      • Integrating with Mailchimp
      • Python Access Datatable
  • Advanced Deployment Settings
    • Installation
      • Pre-installation Planning
      • Deployment
        • Introduction to deployment
        • Minikube install guide
        • AWS ECS Fargate install guide
        • HCL Connections install guide
        • Azure AKS install guide
        • Windows container install guide
      • Buzzy settings
      • Whitelabelling Buzzy
      • Certificates
      • Release Management
    • Performance and Reliability
    • Security
      • Platform
      • Users and Roles
      • Datatables
      • Audit Trail
Powered by GitBook
On this page
  • Data Source Configuration JSON
  • Generic Example
  • Precisely Spectrum Example
  • Oracle Apex Example
  1. The building blocks
  2. Datatables, Fields & Data

Importing data from a URL

PreviousImporting data from a text fileNextImport data from Datatable

Last updated 1 year ago

Buzzy allows data to be imported into a Microapp using an external REST service. Select the Microapp properties, Advanced Tab and then Data Source section. Ensure the URL import radio button is selected. The Data Source Configuration is specified as a JSON document using the “Code” input method. Verify the configuration document works by using the PREVIEW button.

Data Source Configuration JSON

The Objects defined in the document are used to create the request to the external REST service as well as transform the results into the desired format.

These objects include:

  • variables - used to minimize editing in the configuration document by allowing the user to specify local variables, for example host.

  • source - metadata associated with the REST server, including URL, method and page size.

  • params - URL parameters

  • auth - authentication information

  • transforms - JSONata code to apply transformations

  • fields - used to identify destination fields in the Microapp

The document has mandatory objects that must be present even if they are not used: source, auth and transforms.

Generic Example

The following uses an example external REST service: .

Steps:

  1. Create an empty Application (Microapp)

  2. Select Properties, Advanced, Data Source and URL.

  3. Change the input from form to code

  4. Enter the following code:

    {
      "source": {
     "description": "Example import from external REST server",
     "type": "url",
     "config": {
       "url": "https://jsonplaceholder.typicode.com/todos/",
       "method": "GET",
       "paging": {
         "param": "page",
         "check": "$count(features)>0"
       },
       "auth": {
         "user": null,
         "pass": null
       }
     },
     "transforms": []
      },
      "fields": [
     {
       "key": "id",
       "type": "Number",
       "unique": true
     }
      ]
    }
  5. click on PREVIEW The result should be the output of the REST service.

  6. Click on IMPORT

The result will be the the Microapp fields are created and the records populated.

Results window:

Field Defintions:

Data uploaded:

Precisely Spectrum Example

The following import script loads a Microapp with data from a Precisely Spectrum server:


{
  "variables": {
    "host": "demo.spectrumspatial.com",
    "tableName": "/Buzzy/locate/melb_trees_demo",
    "box": "145.05935668945312, -37.88135717974858, 144.8011779785156, -37.73379707124428",
    "limit": 100
  },
  "secrets": {
    "username": "xxx",
    "password": "xxx"
  },
  "source": {
    "description": "Get data from Precisely Spectrum Server",
    "type": "url",
    "config": {
      "url": "https://{{host}}/rest/Spatial/FeatureService/tables/features.json",
      "method": "GET",
      "paging": {
        "param": "page",
        "check": "$count(features)>0"
      },
      "params": {
        "q": "SELECT * FROM \"{{{tableName}}}\" WHERE MI_Intersects(Obj, MI_Box({{box}},'epsg:4326')) LIMIT {{{limit}}}",
        "pageLength": 1000,
        "page": 1
      },
      "auth": {
        "user": "{{username}}",
        "pass": "{{password}}"
      },
      "headers": {},
      "body": {}
    },
    "transforms": [
      "features.{\"id\":id, \"geometry\":geometry, \"properties\":properties}",
      "$~>|*|$merge([properties])|",
      "$.($each(function($v, $k){$k=\"properties\" or $k=\"MI_Style\"?{}:{$k:$v}}) ~> $merge())"
    ]
  },
  "fields": [
    {
      "key": "id",
      "type": "Number",
      "unique": true
    },
    {
      "key": "geometry",
      "type": "GeoJSON"
    }
  ]
}

The JSON objects specific to the Precisely Spectrum server include:

  • variables - The Precisely server, Spectrum tablename, a bounding box in Long/Lat used in a query to filter the original data based on area, and a limit also used in the query.

  • secrets - The username and password to authenticate into the Precisely server.

  • source - metadata associated with the Precisely server, including URL, method and page parameters. These page parameters include the precisely REST parameter page which is used to control the paging cursor and well as the exit criteria.

  • params - The initial URL parameters including the MISQL query, page length (number of features per page) and the initial page number.

  • transforms - JSONata code to apply transformations. Note that this transform automaticaly extracts all of the fields found in the properties GeoJSON document.

Oracle Apex Example

The following import script loads a Microapp with data from an Oracle Apex server:


{
  "source": {
    "description": "Postcode import from Oracle/Apex server",
    "type": "url",
    "config": {
      "url": "https://oracleapex.com:8443/ords/scott/pcode/req",
      "method": "GET",
      "paging": {
        "param": "offset",
        "check": "hasMore",
        "increment": 1000,
        "start": 0
      },
      "auth": {
        "user": "xxx",
        "pass": "xxx"
      },
      "params": {
        "limit": 1000,
        "offset": 0
      }
    },
    "transforms": [
      "$[].items.{'postcode':postcode,'geometry':$eval($replace($replace(geometry, \"[-.\", \"[-0.\"),\"[.\",\"[0.\"))}"
    ]
  },
  "fields": [
    {
      "key": "postcode",
      "type": "string",
      "unique": true
    },
    {
      "key": "geometry",
      "type": "GeoJSON"
    }
  ]
}

The JSON objects specific to Oracle Apex include:

  • source - Contains the URL of the Apex server as well as a reference to the underlying table. The paging mechanism is unique to Apex and uses a hasMore boolean; that tells us if there is more data to retrieve. The variables offset and limit are also Oracle-specific. limit controls the number of objects to n. offset skips n objects before getting first object. The increment value specifies the count to advance. Increment and limit should be set to the same value. The start value should be set to 0 for Oracle Apex.

  • transforms - The Apex server does not output leading 0’s on numbers. This causes a parsing syntax error when transforming the document for Buzzy consumption. To avoid issues at the Prime Meridian, this example checks formissing leading 0’s and adds them into longitude coordinates.


{JSON} Placeholder
Preview