Hello, is someone able to help me, I am try to get a list of events via an api.
I can fetch the events, but can not work out how to get them into a collection.
The code I have done so is below, please don’t laugh I am at the very beginning of my learning curve lol. - Many thanks in advance, Phill
import { fetch } from ‘wix-fetch’ ;
export async function SpEvents ( ) {
let url = “https://system.spektrix.com/eastbournebandstand/api/v3/events”
return fetch ( url , { “method” : “get” })
. then (( httpsResponse ) => {
{
“description”
“htmlDescription”
“duration”
“imageUrl”
“isOnSale”
“name”
“instanceDates”
“thumbnailUrl”
“webEventId”
“id”
“firstInstanceDateTime”
“lastInstanceDateTime”
“attribute_Name”
}
if ( httpsResponse . ok ){
return httpsResponse . json ();
} else {
return Promise . reject ( “Did Not Succeed” );
}
})
}
import wixData from ‘wix-data’ ;
wixData . insert ( “SpektrixDB” , “SpEvents” )
. then ( ( results ) => {
let item = results ;
} )
. catch ( ( err ) => {
let errorMsg = err ;
} );