Places

Create, manage and query Places.

Overview

Place entities describe a fixed physical location, as defined by Schema.org. Places are specified by their name.

Places are not unique by name, across the Graphlit project.

Operations

Create Place

The createPlace mutation enables the creation of a place by accepting the place name, uri and address. It returns essential details, including the ID and name of the newly generated place.

Mutation:

mutation CreatePlace($place: PlaceInput!) {
  createPlace(place: $place) {
    id
    name
  }
}

Variables:

{
  "place": {
    "address": {
      "streetAddress": "1700 WESTLAKE AVE N STE 200",
      "city": "SEATTLE",
      "region": "WA",
      "country": "US",
      "postalCode": "98109"
    },
    "uri": "https://www.graphlit.com",
    "name": "Graphlit HQ"
  }
}

Response:

{
  "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
  "name": "Graphlit HQ"
}
Update Place

The updatePlace mutation enables the updating of a place by accepting the place name and uri.

Mutation:

mutation UpdatePlace($place: PlaceUpdateInput!) {
  updatePlace(place: $place) {
    id
    name
  }
}

Variables:

{
  "place": {
    "uri": "https://www.graphlit.com",
    "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
    "name": "Graphlit Office"
  }
}

Response:

{
  "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
  "name": "Graphlit Office"
}
Delete Place

The deletePlace mutation allows the deletion of a place by utilizing the id parameter, and it returns the ID and state of the deleted place.

Mutation:

mutation DeletePlace($id: ID!) {
  deletePlace(id: $id) {
    id
    state
  }
}

Variables:

{
  "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350"
}

Response:

{
  "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
  "state": "DELETED"
}
Delete Places

The deletePlaces mutation allows the deletion of multiple places, as specified by the ids array parameter, and it returns the ID and state of the deleted places.

Mutation:

mutation DeletePlaces($ids: [ID!]!) {
  deletePlaces(ids: $ids) {
    id
    state
  }
}

Variables:

{
  "ids": [
    "39fcf408p-15ca-4cc2-9476-622d64aa38f3",
    "93476a0c-d567-4624-9d5e-df43dfff92ea"
  ]
}

Response:

[
  {
    "id": "93476a0c-d567-4624-9d5e-df43dfff92ea",
    "state": "DELETED"
  },
  {
    "id": "39fcf408-15ca-4cc2-9476-622d64aa38f3",
    "state": "DELETED"
  }
]
Get Place

The place query allows you to retrieve specific details of a place by providing the id parameter.

Query:

query GetPlace($id: ID!) {
  place(id: $id) {
    id
    name
  }
}

Variables:

{
  "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350"
}

Response:

{
  "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
  "name": "Graphlit Office"
}
Query Places

Query Places

The places query allows you to retrieve all places. It returns a list of place results, including the ID and name for each place.

Query:

query QueryPlaces($filter: PlaceFilter!) {
  places(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
      "name": "Graphlit Office"
    }
  ]
}

Query Places By Name

The places query allows you to retrieve places based on a specific filter criteria, via the name parameter. In this example, the name is set to "Graphlit." It returns a list of place results containing the ID and name for each matching place.

Query:

Query:

query QueryPlaces($filter: PlaceFilter!) {
  places(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "name": "Graphlit",
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "0d5c625e-1ca3-4aa0-b70c-bd4440c26350",
      "name": "Graphlit Office"
    }
  ]
}

Last updated