Search

I’d like to use the Wistia data API from within Symphony to get data on any given video (mainly the download link at the moment) for use on frontend pages.

Wistia’s Data API’s show method is what I’d use. (If you activate the address bar after loading and press return you should get to the method - the viewport doesn’t go to it on page load for some reason.)

Would this be done by creating a new field that queries the API on entry save? If so, what would be the best way of storing the response in the database? The API can return either JSON or XML.

I’ve not created my own field before so I wanted to check I’m on the right track before going ahead.

Take a look at the oembed field. It queries vimeo for a valid url before saving I believe.

You'll need authentication fields queried from the preferences for the GET request as well.

Would this be done by creating a new field that queries the API on entry save? If so, what would be the best way of storing the response in the database? The API can return either JSON or XML.

There is usually two ways you can do this, you can either query and store on Entry save, or you can query on retrieve. Usually the former is preferred, but if you need the data to be 'current' and up to date, you may go down the latter route and implement a cache.

For what you want to do, I'd recommend saving the API response when the entry is created or updated. I'd create a new column on your field extension to store the response, and if you are worried about size, I'd lean JSON over XML.

That said, if you want to output all of that information in to Datasources from your field, it'd be better to save XML in the first place. With JSON you could just selectively build up the XML to represent the data you want to expose.

Thanks for the helpful pointers, chaps.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details