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
  • Show
  • Index
Export as PDF
  1. PlaceCal API

Partners

Show

let queryString = `
query Partner($id: ID!) { 
  partner(id: $id) {
    id
    name
    summary
    description
    accessibilitySummary
    logo
    url
    facebookUrl
    twitterUrl
    address {
      streetAddress
      postalCode
      addressLocality
      addressRegion
      neighbourhood {
        name
        abbreviatedName
        unit
        unitName
        unitCodeKey
        unitCodeValue
      }
    }
    contact {
      name
      email
      telephone
    }
    openingHours {
      dayOfWeek
      opens
      closes
    }
    areasServed {
      name
      abbreviatedName
      unit
      unitName
      unitCodeKey
      unitCodeValue
    }
  }
}`;

query(queryString, { id: 10 })
  .then( (response) => {
    console.log(JSON.stringify(response, null, 2));
  });

/* typical response */
{
  "data": {
    "partner": {
      "id": "10",
      "name": "London Partner",
      "summary": "A Partner in London",
      "description": "Longer description of London Partner is here",
      "accessibilitySummary": "",
      "logo": "",
      "url": "",
      "facebookUrl": "",
      "twitterUrl": "https://twitter.com/",
      "address": null,
      "contact": {
        "name": "Me",
        "email": "me@example.com",
        "telephone": ""
      },
      "openingHours": [],
      "areasServed": [
        {
          "name": "London",
          "abbreviatedName": null,
          "unit": "region",
          "unitName": "London",
          "unitCodeKey": "RGN19CD",
          "unitCodeValue": "E12000007"
        }
      ]
    }
  }
}

Index

Show a sample request returning all events for a given date range with a given partner and tag.

let queryString = `
  query PartnerConnection($first: Int, $after: String) { 
    partnerConnection(first: $first, after: $after) {
      pageInfo {
        hasNextPage
        endCursor
      }
      edges {
        cursor
        node {
          id
          name
          summary
          description
          accessibilitySummary
          logo
          url
          facebookUrl
          twitterUrl
          address {
            streetAddress
            postalCode
            addressLocality
            addressRegion
            neighbourhood {
              name
              abbreviatedName
              unit
              unitName
              unitCodeKey
              unitCodeValue
            }
          }
          contact {
            name
            email
            telephone
          }
          openingHours {
            dayOfWeek
            opens
            closes
          }
          areasServed {
            name
            abbreviatedName
            unit
            unitName
            unitCodeKey
            unitCodeValue
          }
        }
      }
    }
  }`;

/* 
The partnerConnection pagination works the same as event pagination above
*/

/* return the first block of partners */
query(queryString, {first: 3})
  .then( (response) => {
    console.log(JSON.stringify(response, null, 2));
  })

/* response */
{
  "data": {
    "partnerConnection": {
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Mw"
      },
      "edges": [
        {
          "cursor": "MQ",
          "node": {
            "id": "12",
            "name": "Service Area Partner",
            "summary": "",
            "description": "",
            "accessibilitySummary": "",
            "logo": "",
            "url": "",
            "facebookUrl": "",
            "twitterUrl": "https://twitter.com/",
            "address": null,
            "contact": {
              "name": "Me",
              "email": "me@example.com",
              "telephone": ""
            },
            "openingHours": [],
            "areasServed": [
              {
                "name": "London",
                "abbreviatedName": null,
                "unit": "region",
                "unitName": "London",
                "unitCodeKey": "RGN19CD",
                "unitCodeValue": "E12000007"
              }
            ]
          }
        },
        {
          "cursor": "Mg",
          "node": {
            "id": "10",
            "name": "London Partner",
            "summary": "A Partner in London",
            "description": "Longer description of London Partner is here",
            "accessibilitySummary": "",
            "logo": "",
            "url": "",
            "facebookUrl": "",
            "twitterUrl": "https://twitter.com/",
            "address": null,
            "contact": {
              "name": "Me",
              "email": "me@example.com",
              "telephone": ""
            },
            "openingHours": [],
            "areasServed": [
              {
                "name": "London",
                "abbreviatedName": null,
                "unit": "region",
                "unitName": "London",
                "unitCodeKey": "RGN19CD",
                "unitCodeValue": "E12000007"
              }
            ]
          }
        },
        {
          "cursor": "Mw",
          "node": {
            "id": "13",
            "name": "Inner London Partner",
            "summary": "Summary of outer london partner",
            "description": "",
            "accessibilitySummary": "",
            "logo": "",
            "url": "",
            "facebookUrl": "",
            "twitterUrl": "https://twitter.com/",
            "address": null,
            "contact": {
              "name": "",
              "email": "",
              "telephone": ""
            },
            "openingHours": [
              {
                "dayOfWeek": "Monday",
                "opens": "09:00:00",
                "closes": "17:00:00"
              },
              {
                "dayOfWeek": "Tuesday",
                "opens": "09:00:00",
                "closes": "17:00:00"
              },
              {
                "dayOfWeek": "Friday",
                "opens": "09:00:00",
                "closes": "17:00:00"
              }
            ],
            "areasServed": [
              {
                "name": "Inner London",
                "abbreviatedName": null,
                "unit": "county",
                "unitName": "Inner London",
                "unitCodeKey": "CTY19CD",
                "unitCodeValue": "E13000001"
              }
            ]
          }
        }
      ]
    }
  }
}
PreviousEvents

Last updated 11 months ago