Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
blocks:app-note:collection-feed [2021-03-24 15:46]
admin Added Hans video
blocks:app-note:collection-feed [2022-06-14 13:19]
admin typo
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