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-03-24 15:46]
admin Added Hans video
blocks:app-note:collection-feed [2022-06-22 19:07] (current)
admin removed atom references
Line 34: 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 72: 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