All creations and updates are done through mutations called upsert. If the entity id is included in the request, that entity will be updated, otherwise a new entity will be created.

Pass creation

To create/update a pass you will use the upsertPass mutation. It accepts a few different parameters, one of them being inputFieldValues which are the values that differentiate the pass from other passes. Pass input fields are defined on the pass template.

  1. You get the id of the pass template and other ids needed by the upsert mutation by querying your pass templates.
{
  passTemplates {
    data {
      id
      name
      inputFields {
        id
        identifier
      }
    }
  }
}
  1. Use the upsertPass mutation to create a pass with the appropriate input fields (query variables) and get the distributionUrl and distributionQRCode or the variables you need.
mutation UpsertPass($data: PassDataInput!) {
	upsertPass(data: $data) {
		id
    deliveryPageUrl
  }
}
{
	"data": {
		"passTemplateId": "0b68ad0c-17fd-4b89-9e66-ee71b33ed38f",
		"expirationDate": "2021-08-29T00:00:00Z",
    "inputFieldValues": [
			{"identifier": "name", "value": "Helga Katla Jónsdóttir"},
			{"identifier":  "memberId", "value":  "12345"}
		]
  }
}

<aside> 💡 Please look at docs in the GraphQL playground, https://api.passi.is/playground, to see other available parameters.

</aside>