DataSrc:DemoJan25/StrapiEvents: Difference between revisions

    From UNITApedia
    No edit summary
    No edit summary
    Line 1: Line 1:
    == Strapi Events with Subobjects ==
    <!-- 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?token=eef6087adaa5332f80585b5dae629554f2a9cb2d9c4179f66eeaee4d6557a08658dd999aee7388cdc4654513a8fd97745e7d14f6778b2ec2ecbe208bcf4e834785553406c0bee9133d16ae4c299e46b917b73ab554f48af058f4271eb8da6184a018ddae1048fc0047c8e526992cd1e87a84187598c1603e1d88a5152c66c3d8
       |format = JSON
       |format = JSON
       |headers = Authorization: Bearer eef6087adaa5332f80585b5dae629554f2a9cb2d9c4179f66eeaee4d6557a08658dd999aee7388cdc4654513a8fd97745e7d14f6778b2ec2ecbe208bcf4e834785553406c0bee9133d16ae4c299e46b917b73ab554f48af058f4271eb8da6184a018ddae1048fc0047c8e526992cd1e87a84187598c1603e1d88a5152c66c3d8
       |data   = eventId=data.*.id
       |data    = eventId = data.1.id, eventCreated = data.1.attributes.createdAt
      |debug  = 1
    }}
     
    <!-- 2) Store each array element as a subobject -->
    {{#store_external_table: StrapiEvents
      |id        = {{{eventId}}}
      |created    = {{{eventCreated}}}
    }}
     
    <!-- 3) Query the stored data using Semantic MediaWiki (#ask) -->
    {{#ask: [[-Has subobject::{{FULLPAGENAME}}]]
    |?id
    |?created
    |format=table
    |headers=show
    |mainlabel=-
    }}
    }}

    Revision as of 15:32, 27 January 2025