Minimal SpectaQL Example
SpectaQL example using a static schema.
API Endpoints
https://github.com/HugoDF/spectaql-example
Intro item 1
When referencing multiple schemaFile
documents, it merges them.
Eg. Query
will include both book
from schema.gql and id
from other-schema.gql
.
Example information about the API. Supports markdown
. Including tables:
Something | value |
---|---|
Key | "123" |
Queries
books
Response
Returns [Book!]!
Example
Query
query Books {
books {
id
title
author
}
}
Response
{
"data": {
"books": [
{
"id": "784a07a9-d103-4ccb-926f-b38fc6b071f2",
"title": "xyz789",
"author": "xyz789"
}
]
}
}
id
Response
Returns a String!
Example
Query
query Id {
id
}
Response
{"data": {"id": "xyz789"}}
type
Response
Returns an EnumValue!
Example
Query
query Type {
type
}
Response
{"data": {"type": "TYPE_1"}}
Mutations
addBook
Description
Supports GraphQL descriptions
Response
Returns a Book!
Arguments
Name | Description |
---|---|
book - BookInput!
|
Example
Query
mutation AddBook($book: BookInput!) {
addBook(book: $book) {
id
title
author
}
}
Variables
{"book": BookInput}
Response
{
"data": {
"addBook": {
"id": "784a07a9-d103-4ccb-926f-b38fc6b071f2",
"title": "abc123",
"author": "xyz789"
}
}
}
Types
Book
BookInput
Boolean
Description
The Boolean
scalar type represents true
or false
.
EnumValue
Values
Enum Value | Description |
---|---|
|
|
|
Example
"TYPE_1"
ID
Description
The ID
scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4"
) or integer (such as 4
) input value will be accepted as an ID.
Example
4
String
Description
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
Example
"xyz789"