DataSrc:DemoJan25/StrapiEvents: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== | == Strapi Events with Subobjects == | ||
<!-- 1) Fetch the data --> | <!-- 1) Fetch the data with #get_web_data --> | ||
{{#get_web_data: | {{#get_web_data: | ||
|url = https://unitapedia.univ-unita.eu/strapi/api/events | |url = https://unitapedia.univ-unita.eu/strapi/api/events | ||
|format = JSON | |format = JSON | ||
|headers = Authorization: Bearer 6787c45220319c5f69cc2df1bae555309852e81ffe80684a0d2047b49ea0ac011398114999c93d16efd1e0a282f0cce2579b75f84b271cd5895eb78b9d8eee44223797151ff6e1f44878864f148c74da9079c8d32a63a7676f90159aa077f6556f8a678d40eb8820869d12665a73d553af069430c1ff5f7b651370d22edfc7f4 | |headers = Authorization: Bearer 6787c45220319c5f69cc2df1bae555309852e81ffe80684a0d2047b49ea0ac011398114999c93d16efd1e0a282f0cce2579b75f84b271cd5895eb78b9d8eee44223797151ff6e1f44878864f148c74da9079c8d32a63a7676f90159aa077f6556f8a678d40eb8820869d12665a73d553af069430c1ff5f7b651370d22edfc7f4 | ||
|data | |data = eventId = data.*.id, eventCreated = data.*.attributes.createdAt | ||
|debug = 1 | |||
}} | }} | ||
<!-- 2) Store each | <!-- 2) Store each array element as a subobject --> | ||
{{#store_external_table: StrapiEvents | {{#store_external_table: StrapiEvents | ||
| | |id = {{{eventId}}} | ||
| | |created = {{{eventCreated}}} | ||
}} | }} | ||
<!-- 3) Query the stored data --> | <!-- 3) Query the stored data using Semantic MediaWiki (#ask) --> | ||
{{#ask: [[-Has subobject::{{FULLPAGENAME}}]] | {{#ask: [[-Has subobject::{{FULLPAGENAME}}]] | ||
|? | |?id | ||
|? | |?created | ||
|format=table | |format=table | ||
|headers=show | |headers=show | ||
|mainlabel=- | |mainlabel=- | ||
}} | }} |