Using the LessWrong API to query for events

Taymon Beal was pinging us about some help with using the LessWrong API to construct a sidebar for SSC with upcoming meetups. I figured I would write up my response publicly so that other people might be able to learn from it.

As I understand the thing correctly (though Taymon can correct me in the comments) he wanted a way to query the API to get a list of all upcoming SSC meetups. This is the the GraphQL query that I would construct to make that happen (note to myself to fix the code embedding editor component):

{PostsList(terms: {view: “nearbyEvents”, filter: “SSC”, lat: 0, lng: 0}) {
_id
createdAt
title
mongoLocation
location
}}

You can also play around with this interactively on our GraphiQL page.

The “nearbyEvents” view right now requires you to specify a location, and returns all upcoming meetups (to any point in the future) ordered by their distance from that point. You can find the full definition of that view here.