DataSrc:DemoJan25/StrapiEvents: Difference between revisions

    From UNITApedia
    (Created page with "== Testing Strapi API == {{#get_external_data: |source = StrapiEvents |data = firstEventTitle = data.1.attributes.title |debug = 1 }} Retrieved title: {{{firstEventTitle}}}")
     
    No edit summary
    Line 1: Line 1:
    == Testing Strapi API ==
    == Retrieve and Display Strapi Events ==


    <!-- 1) Fetch the events from Strapi -->
    {{#get_external_data:
    {{#get_external_data:
       |source = StrapiEvents
       |source=StrapiEvents
       |data  = firstEventTitle = data.1.attributes.title
       |data= eventId = data.*.id
       |debug = 1
       |data= eventType = data.*.attributes.Type
       |data= eventCategory = data.*.attributes.Category
    }}
    }}


    Retrieved title: {{{firstEventTitle}}}
    <!-- 2) Store each row as a semantic subobject -->
    {{#store_external_table: StrapiEvents
      |event_id={{{eventId}}}
      |event_type={{{eventType}}}
      |event_category={{{eventCategory}}}
    }}
     
    <!-- 3) Query and display the stored data in a table -->
    {{#ask: [[-Has subobject::{{FULLPAGENAME}}]]
    |?event_id
    |?event_type
    |?event_category
    |format=table
    |class=wikitable
    |headers=show
    |mainlabel=-
    }}

    Revision as of 14:11, 27 January 2025

    Retrieve and Display Strapi Events

    Error: No suitable data source is defined for this external data query