GraphQL API Prototype
We are very excited to announce the availability of our experimental GraphQL API prototype.
NOTE: It is a beta version and we recommend to create test space and try prototype in it.
How to try it?
Every space has separate GraphQL API endpoint. The list of available space API endpoints can be found by following the link: {your fibery host}/api/graphql
You will see GraphQL API Explorer after clicking the link for the desired space. You can view the documentation and explore available queries and mutations by clicking Docs in top right corner. It is the place where you can try querying and mutations of your database records.
How to find/list database records
findEntities(params): [Entity]
Finds rows in database. Params consists of database fields/relations filters, offset, limit.
For example:
{
findBugs(name: {contains: "first"}) {
id
name
state{
name
}
assignees{
name
}
}
}
How to modify/create database records
There are multiple operations available for modifying database records. These operations can be performed for found entities by provided filter or for created records in corresponding database.
Find below an example of operations which can be performed for created record. In this example new bug created, assigned to author of API call, description with content âTBDâ is set to bug description.
mutation {
stories {
create(name: "Super Bug") {
message
}
assignToMe {
message
}
appendContentToDescription(value: "TBD") {
message
}
}
}
For creating multiple records batch operation command createBatch can be used.
mutation {
stories {
createBatch(data: [
{name: "Bug 1"}
{name: "Bug 2"}
]) {
entities {
id
}
}
assignToMe {
message
}
appendContentToDescription(value: "TBD") {
message
}
}
}
Find below the example of operations which can be performed for found records by provided filter as params to root node of mutation. Bugs with word âfirstâ in name are moved into âIn Progressâ state, sprint is unlinked, found bugs are assigned to author of API call and the owner of found stories is notified.
mutation {
bugs(name:{contains: "first"}){
update(state: {name: {is: "In Progress"}}) {
message
entities {
id
}
}
unlinkSprint {
message
}
assignToMe {
message
}
notifyCreatedBy(subject: "Assigned to Aleh") {
message
}
}
}
We will publish more articles and tutorials about using graphql after the official release. Now we really appreciate your feedback. Ideas, questions or issues are very welcome.
Please let us know about your thoughts.