Jeremy Felt

How we’re using the WP REST API at Washington State University

As I write this, we have the WP REST API enabled for 1083 sites across 54 networks on our single installation of WordPress at Washington State University.

It’s probably worth noting that this only counts as one active installation in the WordPress.org repository stats. 🙁 It’s definitely worth noting how we use it! 🙂

Our primary use for the WP REST API is to share content throughout the University via our WSUWP Content Syndicate plugin. With the simple wsuwp_json shortcode, anyone is able to embed a list of headlines from articles published on news.wsu.edu.

[wsuwp_json output=”headlines” count=”4″]

And just by changing the host, I can switch over and embed a couple of recent headlines from web.wsu.edu.

[wsuwp_json output=”headlines” count=”2″ host=”web.wsu.edu”]

Having the ability to share information across the University is very useful to us. It helps various groups and sites throughout the ecosystem feel more connected as visitors and as site owners.

Of course, we could have used a pre-existing syndication format like RSS as a solution, but a REST API is so much more flexible. It didn’t take much work to extend the initial plugin using things like register_rest_field() to support and display results from the central people directory we have in progress.

Removed: shortcode displaying my profile at WSU.

That’s me, pulled in from our people API.

This kind of data flexibility is a big part of our vision for the future of the web at WSU. Soon we’ll be able to highlight information for research faculty that may help to connect them with other groups working on similar topics. We’ll have ways to create articles on the edge of the network and have them bubble up through the various layers of the university—department, college, central news. And we’ll be able to start tying data to people in a smarter way so that we can help to make sure voices throughout the university are heard.

And that’s just our first angle! One day I’ll expand on how we see the REST API changing our front end workflow in creative ways.

Updated Oct 21, 2021: Removed the “top-stories” category restriction from the shortcode pulling in articles from news.wsu.edu as that category is no longer used. Shortcode still works! Removed the shortcode I was using to retrieve my profile from people.wsu.edu, as I’m not sure if I have a profile anymore. Also: converted post content to blocks.

Responses and reactions

Replies

Curtiss replied on 

Have you guys worked at all on pushing/syndicating content to a centralized site with the REST API as opposed to pulling content from a centralized site? That's one of the ways we're managing emergency alerts on campus (if there's a department-specific alert, they can post it to their site, and it's syndicated/pushed to our central advisories site), and I'd be curious to see what you guys are doing with that.

Leave a Reply

Your email address will not be published. Required fields are marked *

The only requirement for your mention to be recognized is a link to this post in your post's content. You can update or delete your post and then re-submit the URL in the form to update or remove your response from this page.

Learn more about Webmentions.