28

Is it the right RSS feed?

RSS lives and the topic has come up a few times recently. It got me thinking and reading stuff I haven’t looked at in a long time. Alan’s Feed WordPress 101 is still gold and reminded me of all kinds of things I had forgotten. Back in the glory days of RSS and the Mother Blog, the hardest part was usually getting the right URL for the feed. Alan had all sorts of ways to try to help people. We built a choose your own adventure path into the old Thought Vectors process but often we’d resort to doing it manually for people. I thought that maybe I could build something using WordPress’s REST API that might make checking the feed validity more interactive and obvious. What you can see below is an early proof of concept.1 Anyway, I built it initially and congratulated myself. Then I realized I’d only tested it on my own site and it didn’t work on any other site. Why? CORS. CORS. CORS. I had set up my own site long ago to allow access to the API from other sites but that’s not the default state in WordPress. A bit of Googling led me to a PHP proxy on GitHub that was made to deal with just this issue. I also had some hassle […]

26

Omeka REST API Experiment

In the Domain of One’s Own workshop yesterday, Ed Beck‘s work around integrating Omeka and WordPress came up. It led me to check out the Omeka S API. I made a functional example in CodePen and a couple of things came up that might be of interest. First, why do something like this? You have some options here. You could use FeedWordPress and syndicate the content over but I’m less and less of a fan of having copies of data everywhere. It gets messy. You could probably iframe some chunk of the Omeka piece into WordPress but that’s messy in other ways. You have to theme two different systems, removing chunks of a site (like the header) in iframes is a hassle. The API route can solve those problems. The data is clean. You can structure it how you’d like and add classes or whatever you need to it merges seamlessly with the existing WP theme CSS or you can tweak it to do what you need but there’s no battling with Omeka structure or CSS. It’s a clean way to include the data of your choosing within the visual frame of WordPress. Hassles One problem with a lot of REST APIs these days is CORS issues. I used a PHP proxy to get around that but I need to […]

Small red plastic toy shovel.

An Option for dealing with CORS

As we do more things with JSON, I run into CORS access issues. They can be solved in various ways but it’s often a hassle. It often irritates me as I build demos in COde After wanting a simple solution this AM, I made this tiny, insignificant PHP file that I think might be useful to others. Name this file cors.php.1 Put this file on a server. You can now append some JSON URL to that URL like so … https://yourserver.com/cors.php?url=https://someurl.com/data.json and it returns drama-free JSON for your use and enjoyment. Assuming you have HTTPs on your server it should also deal with HTTP/HTTPS conflicts as well which is very handy at times. 1 Or name it whatever you want. I’m going using bossiness as a shortcut to clarity.