PlaceCal Handbook
  • Introduction
  • How to
    • Log in to PlaceCal
    • Add a Partner
    • Configure a Partner
    • Add a User
    • Add a Calendar
    • Add a Site
    • Configure a Site
    • Add a Tag (Partnership)
  • Reference
    • Supported Calendar sources
      • JSON-LD (generic)
      • iCal (generic)
      • Airtable
      • Dice.fm
      • Eventbrite
      • Google Calendar
      • iCloud Calendar
      • Meetup
      • Outlook 365
      • OutSavvy
      • Resident Advisor (RA)
      • Squarespace
      • Ticketsolve
    • Glossary
      • Calendars
      • Districts
      • Events
      • Neighbourhoods
      • Organisers
      • Partners
      • Partnerships
      • User roles
        • Neighbourhood admins
        • Partner admins
        • Partnership admins
        • Root
        • Site admins
      • Wards
      • Sites
  • Explanation
    • Community Technology Partnerships
    • Structured and unstructured data
    • Resisting walled gardens and big tech silos
  • PlaceCal API
    • Getting started
    • Data structures
    • Making queries
    • Ping
    • Events
    • Partners
Powered by GitBook
On this page
Export as PDF
  1. PlaceCal API

Making queries

Currently we only serve read queries and no mutations. The examples are written in javascript.

The following code is a bare-bones query wrapper using the node-fetch npm module.

import fetch from 'node-fetch';

const endPoint = 'http://192.168.0.39:3000/api/v1/graphql';

function query (query, variables) {
  return new Promise((resolve, reject) => {
    fetch(endPoint, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
      },
      body: JSON.stringify({
        variables,
        query
      })
    })
    .then(r => r.json())
    .then(data => resolve(data))
  });
}
PreviousData structuresNextPing

Last updated 11 months ago