简体   繁体   中英

Fetching nearest events with user location using meetup.com GraphQL API

I am trying to find out a way to fetch nearby events using GraphQL meetup.com API. After digging into the documentation for quite some time, I wasn't able to find a query that suits my needs. Furthermore, I wasn't able to find old, REST, documentation, where, the solution for my case might be present.

Thanks in advance !

This is what I could figure out so far, the Documentation for SearchNode is missing, but I could get id's for events:

query($filter: SearchConnectionFilter!) {
    keywordSearch(filter: $filter) {
      count
      edges {
        cursor
        node {
          id
          
        }
      }
    }
  }

Input JSON:

{ "filter" : { 
    "query" : "party", 
    "lat" : 43.8, 
    "lon" : -79.4, "radius" : 100,
    "source" : "EVENTS" 
    }
}

Hope that helps. Trying to figure out this new GraphQL API

You can do something like this (customize it with whatever fields you want from Event ):

const axios = require('axios');

const data = {
  query: `
query($filter: SearchConnectionFilter!) {
  keywordSearch(filter: $filter) {
    count
    edges {
      cursor
      node {
        id
        result {
          ... on Event {
            title
            eventUrl
            description
            dateTime
            going
          }
        }
      }
    }
  }
}`,
  variables: {
    filter: {
      query: "party",
      lat: 43.8,
      lon: -79.4,
      radius: 100,
      source: "EVENTS",
    },
  },
};

axios({
  method: "post",
  url: `https://api.meetup.com/gql`,
  headers: {
    Authorization: `Bearer YOUR_OAUTH_ACCESS_TOKEN`,
  },
  data,
})


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM