# GraphQL API Prototype

**URL:** <https://community.fibery.io/t/graphql-api-prototype/2769>\
**Category:** API & Programming\
**Tags:** graphql, api\
**Created:** [May 5, 2022, 1:07pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769 "2022-05-05T13:07:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [May 5, 2022, 1:07pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/1 "2022-05-05T13:07:52Z")

</div>

# 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`

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/a/ac17660e654b34422a42934e9e8763b2d3122a6a.jpeg)

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.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/c/c411663996733a0bb73791c4df6b22e466c3b63e.png)

## How to find/list database records

### findEntities(params): [Entity]

Finds rows in database. **Params** consists of database fields/relations filters, offset, limit.

For example:

```auto
{
  findBugs(name: {contains: "first"}) {
    id
    name
    state{
      name
    }
    assignees{
      name
    }
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/e/e7860065e3cd4c3030a3c98b4f2fae7fa2a77604.png)

## 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.

```auto
mutation {
  stories {
    create(name: "Super Bug") {
      message
    }
    assignToMe {
      message
    }
    appendContentToDescription(value: "TBD") {
      message
    }
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/2/24a686982d2c964f99107304febb01771b614165.png)

For creating multiple records batch operation command **createBatch** can be used.

```auto
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.

```auto
 mutation {
  bugs(name:{contains: "first"}){
    update(state: {name: {is: "In Progress"}}) {
      message
      entities {
        id
      }
    }
    unlinkSprint {
      message
    }
    assignToMe {
      message
    }
    notifyCreatedBy(subject: "Assigned to Aleh") {
      message
    }
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/b/b54907e8d375c80afc577d10e5a71c167c4ecc9c.png)

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.

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [May 5, 2022, 1:28pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/2 "2022-05-05T13:28:54Z")

</div>

I noticed this in the backlog and have been interested to try it out. Not only is it more intuitive to build queries vs the current API, but it could open up interesting use cases with other tooling that supports GraphQL.

I was able to pretty easily query some data within a few seconds of playing around with it. For example, getting all initiatives with their name, then any related ideas and their name.

```auto
{
  findInitiatives{
    name,
    ideas{
      name
    }
  }
}

```

The only thing I can think of is it would be nice to have some examples for quickly leveraging this in a simple HTTP request like you have in the other API docs if you don’t have that already. Or, better yet if there is some way to just copy that to your clipboard for the current query, that could be useful.

Basically, a stubbed out example using curl, fetch (js), requests (python), etc where people can quickly take the query that is working in the graphiql playground, then leverage it in a script.

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [May 5, 2022, 2:25pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/3 "2022-05-05T14:25:18Z")

</div>

Hello, @rothnic

Thanks for feedback. We will add more code samples and documentation later.

By the way rich fields can be retrieved as well in md, text, html or jsonString formats.

```auto
{
  findFeatures{
    name,
    description{
      text
    }
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/3/3984652eca743c1b783cb2f481e999ad9718f7f2.png)

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [May 5, 2022, 2:53pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/4 "2022-05-05T14:53:26Z")

</div>

Nice, I was curious about that.

One other thing I’d mention that might be a little bit more intuitive is using the explorer extension for graphiql. It was used in another project (maybe Hasura?) I played with a bit and found it useful. I don’t know whether it is complex to setup, maintain, etc though.

> **[GitHub - OneGraph/graphiql-explorer: Explorer plugin for GraphiQL](https://github.com/OneGraph/graphiql-explorer)**
>
> Explorer plugin for GraphiQL. Contribute to OneGraph/graphiql-explorer development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [May 5, 2022, 9:52pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/5 "2022-05-05T21:52:09Z")

</div>

I can query a collection’s contents and get a list of entities as expected, but I am not able to query a _related entity’s_ collection. Is this a fundamental limitation?

E.g. “Meeting Notes” has a related “Client”, and “Client” contains a collection of “Projects”

**THESE WORK:**

```auto
{ findClients(limit:1) {
  projects { id name }  
  }
}

{ findMeetingNotes(limit:1) {
  defaultProject{
    id name
  }
}}

```

**THIS DOESN’T WORK:**

```auto
{ findMeetingNotes(limit:1) {
  client{
    projects{
      id name
    }
  }
}}

"message": "Invalid query.\nCause: Unknown query select expression Organization/Client, {\"q/from\":\"Project/Projects\",\"q/select\":{\"id\":[\"fibery/id\"]},\"q/limit\":1000}.",

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [May 6, 2022, 8:39am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/6 "2022-05-06T08:39:50Z")

</div>

Hello, @Matt_Blais

Thanks for the feedback. We will check, probably it is a bug or it is a limitation of our fibery core and this type of querying will not be possible.

Thanks,  
Oleg

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [May 12, 2022, 2:24pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/7 "2022-05-12T14:24:04Z")

</div>

Really nice!

Is there a plan for what kind of graph capabilities you intend to add to Fibery?

\m/

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [May 20, 2022, 12:12pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/8 "2022-05-20T12:12:01Z")

</div>

I am trying to query the endpoints from Apollo [Studio](https://studio.apollographql.com/sandbox/explorer) but i cannot get it to work. I am guessing it is an authentication issue.

Is there a way to access the endpoints from other graphql clients?

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [May 20, 2022, 12:42pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/9 "2022-05-20T12:42:12Z")

</div>

Hello, @Mikkling

You may use other clients. Please configure corresponding auth header for your client:

```auto
Authorization: Token YOUR_TOKEN

```

Please [find here](https://api.fibery.io/#authentication) how to retrieve auth token and how to add auth header.  
Below an example how I configured My WebStorm GraphQL Client:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/9/9584a37ecc839342ade6398b86498fd761684340.png)

Thanks,  
Oleg

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [May 20, 2022, 3:53pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/10 "2022-05-20T15:53:18Z")

</div>

Thanks!

I managed to query my endpoints in Insomnia, so now i know it works!

I still cannot get Apollo Explorer to authenticate successfully…

---

<div class="post-metadata">

**Author:** ![NWE](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/nwe/32/4696_2.png) [@NWE](https://community.fibery.io/u/NWE)\
**Post date:** [May 27, 2022, 1:10pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/11 "2022-05-27T13:10:45Z")

</div>

This is very interesting and works great the little I’ve tested.

Should we expect graphQL take over when finished and the ‘old’ api will be redundant?  
Even upload and attach files?  
(I’m using fibery as a CMS for phones and attach files through the current api when needed)

I agree with the above post about some good examples later on.

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [July 20, 2022, 12:54am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/12 "2022-07-20T00:54:23Z")

</div>

@Oleg  
How to **update** a Rich Text field with GraphQL? Rich Text fields like “description” do not appear in the GraphiQL docs under “update”.

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [July 20, 2022, 7:13am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/13 "2022-07-20T07:13:52Z")

</div>

Hi, @Matt_Blais

Please use one of the following methods to update rich fields (markdown templates are supported):

```auto
mutation{
  features(id:{is:"ABC"}) {
    overwriteDescription(value:"rewrite {{NAME}} desc"){message}
    appendContentToDescription(value: "text to append"){message}
    prependContentToDescription(value: "text to prepend"){message}
  }
}

```

Thanks,  
Oleg

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [July 20, 2022, 10:47pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/14 "2022-07-20T22:47:12Z")

</div>

@Oleg  
Thanks - is “features(id)” the Rich Text secret?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 21, 2022, 7:13am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/15 "2022-07-21T07:13:55Z")

</div>

> [@Matt\_Blais](#):
>
> Thanks - is “features(id)” the Rich Text secret?

No, it’s just an example of how to choose which entity to update.  
In this case, we’re updating a feature whose Id equals “ABC”.

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [July 21, 2022, 9:01am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/16 "2022-07-21T09:01:03Z")

</div>

Right, Feature is database, Description is a name of rich field

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [July 21, 2022, 4:08pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/17 "2022-07-21T16:08:49Z")

</div>

So `overwriteX` `prependX` and `appendX` exist for every Rich Text field “X”?

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [July 22, 2022, 7:20am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/18 "2022-07-22T07:20:33Z")

</div>

Hi, @Matt_Blais

It is correct. `overwriteX`, `prependX` and `appendX` exist for every Rich Text field “X”

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [July 22, 2022, 11:39pm UTC](https://community.fibery.io/t/graphql-api-prototype/2769/19 "2022-07-22T23:39:51Z")

</div>

Is only markdown supported for updating Rich Text fields via GraphQL?

I am trying to clone an entity, including duplicating the Rich Text Description, but if I must use Markdown then much of the formatting is lost (e.g. colors). I would like to use HTML format, since it preserves the formatting.

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [July 25, 2022, 11:47am UTC](https://community.fibery.io/t/graphql-api-prototype/2769/20 "2022-07-25T11:47:50Z")

</div>

Hi, @Matt_Blais

It is only markdown for now. But thanks for feedback. I will add the feature about extending with HTML support. Can not give exact estimates, but we will implement it in future.

Thanks,  
Oleg
