Persons
Create, manage and query Persons.
Last updated
Was this helpful?
Create, manage and query Persons.
Last updated
Was this helpful?
Persons (people) entities describe a living, deceased or fictional person, as defined by . Persons are specified by their name, or optionally their given (first) and family (last) names. They can optionally contain an email address, as well.
Persons are not unique by name, across the Graphlit project, but if an email address is specified, they are unique by email address.
The createPerson
mutation enables the creation of a person by accepting the person name
. It returns essential details, including the ID and name of the newly generated person.
Mutation:
mutation CreatePerson($person: PersonInput!) {
createPerson(person: $person) {
id
name
}
}
Variables:
{
"person": {
"email": "kirk.marple@gmail.com",
"givenName": "Kirk",
"familyName": "Marple",
"name": "Kirk Marple"
}
}
Response:
{
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
The updatePerson
mutation enables the updating of a person by accepting the person name
.
Mutation:
mutation UpdatePerson($person: PersonUpdateInput!) {
updatePerson(person: $person) {
id
name
}
}
Variables:
{
"person": {
"email": "kirk@unstruk.com",
"givenName": "Kirk",
"familyName": "Marple",
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
}
Response:
{
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
The deletePerson
mutation allows the deletion of a person by utilizing the id
parameter, and it returns the ID and state of the deleted person.
Mutation:
mutation DeletePerson($id: ID!) {
deletePerson(id: $id) {
id
state
}
}
Variables:
{
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573"
}
Response:
{
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"state": "DELETED"
}
The deletePersons
mutation allows the deletion of multiple persons, as specified by the ids
array parameter, and it returns the ID and state of the deleted persons.
Mutation:
mutation DeletePersons($ids: [ID!]!) {
deletePersons(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"
}
]
The person
query allows you to retrieve specific details of a person by providing the id
parameter.
Query:
query GetPerson($id: ID!) {
person(id: $id) {
id
name
email
givenName
familyName
}
}
Variables:
{
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573"
}
Response:
{
"email": "kirk@unstruk.com",
"givenName": "Kirk",
"familyName": "Marple",
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
Query Persons
The persons
query allows you to retrieve all persons. It returns a list of person results, including the ID and name for each person.
Query:
query QueryPersons($filter: PersonFilter!) {
persons(filter: $filter) {
results {
id
name
}
}
}
Variables:
{
"filter": {
"offset": 0,
"limit": 100
}
}
Response:
{
"results": [
{
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
]
}
Query Persons By Name
The persons
query allows you to retrieve persons based on a specific filter criteria, via the name
parameter. In this example, the name
is set to "Kirk". It returns a list of person results containing the ID, names and email for each matching person.
Query:
query QueryPersons($filter: PersonFilter!) {
persons(filter: $filter) {
results {
id
name
email
givenName
familyName
}
}
}
Variables:
{
"filter": {
"name": "Kirk",
"offset": 0,
"limit": 100
}
}
Response:
{
"results": [
{
"email": "kirk@unstruk.com",
"givenName": "Kirk",
"familyName": "Marple",
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
]
}
Query Persons By Email
The persons
query allows you to retrieve persons based on a specific filter criteria, via the email
parameter. In this example, the email
is set to "unstruk.com", and will find any emails with that domain. It returns a list of person results containing the ID, names and email for each matching person.
Query:
query QueryPersons($filter: PersonFilter!) {
persons(filter: $filter) {
results {
id
name
email
givenName
familyName
}
}
}
Variables:
{
"filter": {
"email": "unstruk.com",
"offset": 0,
"limit": 100
}
}
Response:
{
"results": [
{
"email": "kirk@unstruk.com",
"givenName": "Kirk",
"familyName": "Marple",
"id": "d1fb910f-4902-44ce-95b9-1e23d85e7573",
"name": "Kirk Marple"
}
]
}
Queries
Mutations
Objects