Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blocks:app-note:collection-feed [2021-02-08 10:40]
admin Removed readonly to make simpler
blocks:app-note:collection-feed [2022-06-22 19:07] (current)
admin removed atom references
Line 1: Line 1:
 ====== Displaying an External Data Source ====== ====== Displaying an External Data Source ======
  
-Blocks version 5 introduces support for external collection databases. This can be very useful for places like museums, often using such databases to keep track of descriptions, metadata, images and other content related to their artifacts and exhibits.+Blocks version 5 introduces support for external collection databases. This can be very useful for places like museums, often using such databases to keep track of descriptions, metadata, images and other content related to their artifacts and exhibits. Here's Hans Ruedisueli of Bureau Jorwert in The Netherlands – an expert in database-driven presentations – talking about how he uses this feature 5 to integrate external collection databases in presentations made with Blocks.  
 + 
 +{{vimeo>528378235}}
  
 This application note provides an example of such a solution, showing a number of collections based on openly available data and images published by the [[https://maas.museum|Museum of Applied Arts & Sciences]] in Sydney, Australia. They provide an [[https://maas.museum/api-documentation/overview/graphql/|open API]] for accessing their collection database from anywhere in the world. More commonly, such a collection database is intended for internal access only, although some are open to the public, like this one.  This application note provides an example of such a solution, showing a number of collections based on openly available data and images published by the [[https://maas.museum|Museum of Applied Arts & Sciences]] in Sydney, Australia. They provide an [[https://maas.museum/api-documentation/overview/graphql/|open API]] for accessing their collection database from anywhere in the world. More commonly, such a collection database is intended for internal access only, although some are open to the public, like this one. 
Line 16: Line 18:
  
 {{vimeo>508779815}} {{vimeo>508779815}}
- 
  
 ===== Installation ===== ===== Installation =====
Line 33: Line 34:
 A feed script has many similarities with a network device driver in Blocks, and requires the same kind of [[blocks:drivers:tools|tools]] and [[blocks:drivers:concepts|skills]]. Thus, you may want to start by learning about how to develop device drivers and user scripts. The following description assumes such familiarity. A feed script has many similarities with a network device driver in Blocks, and requires the same kind of [[blocks:drivers:tools|tools]] and [[blocks:drivers:concepts|skills]]. Thus, you may want to start by learning about how to develop device drivers and user scripts. The following description assumes such familiarity.
  
-To follow along with the descriptions below, open the script/feed/Maas.ts script included in this application note using a suitable code editor – such as Atom – as described in the wiki article linked in the previous paragraph.+To follow along with the descriptions below, open the script/feed/Maas.ts script included in this application note using a suitable  [[blocks:drivers:tools|code editor]].
  
 ==== Location and Name of a Feed Script ==== ==== Location and Name of a Feed Script ====
Line 71: Line 72:
 Interfacing with an external database can sometimes be rather complicated. The backend used by this example uses [[https://graphql.org|GraphQL]], which provides a great deal of flexibility in querying for only the desired data. The result is returned as JSON, which can be automatically interpreted by Blocks. This automatic interpretation is triggered by the //interpretResponse: true// option passed to newRequest, and requires that the [[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type|Content-Type]] header of the returned data is set correctly. The resulting data can then be directly used by the feed script. In a similar way, Blocks can auto-interpret XML data. Alternatively, do not pass the //interpretResponse: true// option, making Blocks instead return the raw text of the result, allowing you to parse and interpret it manually in your feed script. Interfacing with an external database can sometimes be rather complicated. The backend used by this example uses [[https://graphql.org|GraphQL]], which provides a great deal of flexibility in querying for only the desired data. The result is returned as JSON, which can be automatically interpreted by Blocks. This automatic interpretation is triggered by the //interpretResponse: true// option passed to newRequest, and requires that the [[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type|Content-Type]] header of the returned data is set correctly. The resulting data can then be directly used by the feed script. In a similar way, Blocks can auto-interpret XML data. Alternatively, do not pass the //interpretResponse: true// option, making Blocks instead return the raw text of the result, allowing you to parse and interpret it manually in your feed script.
  
-You're note limited to using the SimpleHTTP API for fetching the data (although it's the most common method). You can use any suitable Blocks API for fetching the data, such as SimpleSQL or SimpleFile.+You're not limited to using the SimpleHTTP API for fetching the data (although it's the most common method). You can use any suitable Blocks API for fetching the data, such as SimpleSQL or SimpleFile.
  
 While the data returned from the database hopefully includes the data you need, it's typically not formatted or packaged in the desired way. Thus, your script must re-format the data returned While the data returned from the database hopefully includes the data you need, it's typically not formatted or packaged in the desired way. Thus, your script must re-format the data returned