Building a Machine-Readable List of WordPress Events

In #hosting-community, it was brought up that several hosts are interested in collecting data of local WordCamps and WordPress Meetups to promote attendance to customers. With many events happening around the world, the first task is to build a reliable source of data. The most important WordPress-related events are collected in two places: WordCamp Central and Meetup. Both sites have APIs to retrieve these lists.

WordCamp CentralWordCamp Central Website for all WordCamp activities globally. https://central.wordcamp.org includes a list of upcoming and past camp with links to each. Events

The WordCamp Central APIAPI An Application Programming Interface (API) is a computing interface that defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc. does not require an API key, so no setup is required. To pull the last 100 modified WordCampWordCamp WordCamps are casual, locally-organized conferences covering everything related to WordPress. They're one of the places where the WordPress community comes together to teach one another what they’ve learned throughout the year and share the joy. Learn more. events use the following request:

[user@localhost]$ curl -g 'https://central.wordcamp.org/wp-json/posts?type=wordcamp&filter[posts_per_page]=100'

The response is formatted as JSONJSON JavaScript Object Notation (JSON) is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types. It is a very common data format, with a diverse range of applications, such as serving as a replacement for XML in AJAX systems.. If filter[posts_per_page] isn’t added, you’ll get only the default amount of results (8, at the time of writing this). To get a more readable output, you can use jq and less on Linux/MacOS (you may need to install jq using your package manager):

[user@localhost]$ curl -g 'https://central.wordcamp.org/wp-json/posts?type=wordcamp&filter[posts_per_page]=100' | jq '.' | less

The top level element is a list. Each element in the list is an objectObject In computer science, an object can be a variable, a data structure, a function, or a method, and as such, is a value in memory referenced by an identifier. with key/value pairs. The post_meta element is a list that contains objects for metadata including location, Twitter hashtag, start and end date (in epoch format), and other useful details of approved WordCamps. The location does not follow a strict format and is usually “city, country” or “city, state” if in the United States, but some WordCamps follow a slightly different format, and the Community Team has suggested an effort to standardize format and normalize the previous values. A good next step is to connect with the Community team to see if the HostingHosting A web hosting service is a type of Internet hosting service that allows individuals and organizations to make their website accessible via the World Wide Web. team can help out here, since that will make it so that the country retrieved will always be accurate.

MeetupMeetup All local/regional gatherings that are officially a part of the WordPress world but are not WordCamps are organized through https://www.meetup.com/. A meetup is typically a chance for local WordPress users to get together and share new ideas and seek help from one another. Searching for ‘WordPress’ on meetup.com will help you find options in your area. Events

The other source of events is on Meetup Their API requires a developer key, which can be created for free. To get a JSON formatted object of all scheduled WordPress Meetups, use:

[user@localhost]$ curl -g "https://api.meetup.com/2/events?member_id=72560962&key=$KEY&sign=true"

Be sure to change $KEY in the URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org to your API key or it will not work. Again, you can use jq and less to parse the JSON:

[user@localhost]$ curl -g "https://api.meetup.com/2/events?member_id=72560962&key=$KEY&sign=true" | jq '.' | less

The member_id value 72560962 is the id for the WordPress Foundation Meetup account, and by specifying this, the API returns all WordPress official events, rather than the events for a single Meetup group.

The JSON that the Meetup API returns has a different schema than the WordCamp Central API JSON responses. For Meetup, the top level entity is an object, and the main key to look at is results. This contains a list of objects, and each object represents a WordPress Meetup. Each Meetup has a lot of metadata associated with it. Some important ones to know about are time, which is in epoch format * 1000, venue, which is an object with information about the venue, name, which is the name of the WordPress Meetup, and event_url, which is the website for the event. The venue‘s localized_country_name and city keys can be used together to replicate the WordCamp API’s location object.

Bringing it All Together

To get the full list of WordCamps and Meetups, a script is needed to pull from both sources and combine them into one list. An example script can be found on GitHub to see how a host might retrieve the data and combine the two sources. There is also an Official WordPress Events pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory or can be cost-based plugin from a third-party., which creates this page, that can be used.

#hosting-community