Jump to content

Third party API / server-side workaround

Recommended Posts

Hi folks!

I'm in the process of overhauling the website for my current organisation, and having built multiple Squarespace sites, my preference is to build here, however I have one problem I'm currently trying to solve. The website will need to integrate with our box office system (likely Spektrix - API documentation here) - the integration will need to be via API so that we can power complex filtering of shows, which the iframe doesn't do (we're a large festival with 100s of shows so this is crucial). Once the user has browsed the storefront/what's on page, using various filters, they'd click into an event and be taken to an event details page (secondary question on this below), and then if they decide to book tickets, at that point we'd pass them on to the Spektrix iframe journey through to purchase completion.

Since SQS doesn't support server-side php, I'm wondering if this is a viable workaround to integrate the box office and create the 'what's on' page with filtering options:

1. Host the PHP code on an external web hosting service that supports PHP. The server will act as the API server, handling requests to the Spektrix API and returning the JSON data.
2. Add a custom code block to the SQS page (what’s on). Use JavaScript & HTML in the custom code block with the API URLs pointing to the external server hosting the PHP code. Parse the JSON response and dynamically generate the event listings in HTML.
3. Client-Side Filtering: Since Squarespace doesn't support server-side PHP filtering, implement client-side filtering using JavaScript. Use JavaScript to handle the user's category/genre/date range etc selections and make AJAX requests to the external API server with the appropriate filtering parameters.
4. The HTML and JavaScript code will handle making requests to the external API server, retrieving filtered events, and displaying them on the page.

Would this work, or I am wasting my time trying to achieve this with SQS? Are there any other workarounds?

Secondary question: Each event in the programme (often 500+) will need to have its own event details page (example page here - not my website, but another that uses Spektrix API, likely with Craft CMS). Is there any way to programmatically create these pages in SQS? For example if I could I use the external API to retrieve event data, and then programmatically generate static HTML pages for each event on the external server, is there any way to then import these into SQS? Wondering if I could export the HTML pages as an XML file, then upload to SQS - though I imagine the formatting would be all over the place and I'd have to convert each page to fluid engine and then wrangle the content to follow the template - but that probably still quicker than manually inputting all of the content and assets to the individual event pages... I'd also need to figure out an automation to hyperlink the event pages to their 'storefont' preview via the eventID... any insights or thoughts on this process would be greatly appreciated! 

Thanks in advance for any advice and insights!

Sincerely (losing my mind),

Link to comment
  • Replies 1
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

In my opinion, Squarespace isn't suitable for use with Spektrix unless you can meet your requirements with the simple iframe embed method. 


About me: I'm Paul. A SQSP User for 18 yrs, I joined Circle when it launched in 2016 and have been a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing expertise and extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee fuels my work.

Book paid help with a Squarespace Domain

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.