Retrieve linked entry content

Hey folks,

I’m a little stuck on getting an entries content in graphql. This is part of a result being returned from a UI extension. bar is a link to another piece of Contentful content with a title and a rich text field. However, it does not return any of the content of that entry.

Do I need to change the way that the UI Extension is linking/referencing the entry or do I need to change the graphql to get this data?

        "id": "c007b16cf-1a59-49b9-b021-bfdadd9a4f8c",
        "properties": {
            "bar": {
                "id": "6CgVIVpX7nB5a3oqhf0xsl",
                "type": "Entry",
                "contentType": {
                    "sys": {
                        "type": "Link",
                        "linkType": "ContentType",
                        "id": "simpleRichTextBlock"

Any pointers much appreciated,


Hi @neild! Welcome!

Can you give some more details/context about your setup? I think I understand what you are trying to do, but I don’t understand enough about this UI extension you mention and the field it is sitting on to answer your question.

  • in what type of field is this data?
  • what does the UI extension do?
  • is the UI extension making GraphQL calls or is the rendering application making GraphQL calls?
  • what are you expecting to happen?

Hi @charlie,

Thanks for getting back to me!

The extension is used to create a flow chart /decision tree with interconnected nodes containing multiple choice questions that eventually lead to a result node. In each question node or result I am adding some extra text which is another Contentful entry (content type of simpleRichTextBlock).

The extension itself does not make any graphql calls and generates JSON which is saved in the field it is assigned to.

I’m then querying this field in Gatsby and hoping to get something back like the below for that entry that I have chosen:

“title” : “bar”,
“content”: {
// rich text content

So the JSON generated by the extension is saved in a JSON object field type, right? If that’s the case then that is why your GraphQL API request isn’t resolving the referenced entry. JSON objects are just oblique blobs of JSON to our API, we don’t interpret them in any way. To resolve referenced entries, make the underlying field type a Reference (either single or multiple). Or you’d have to make a second API call to resolve the entry as stored in your JSON blob by the UI extension.

1 Like

I made a little diagram a while ago to show how I think a Question tree content model could be made. You might find it interesting.

This is all using native reference fields in Contentful and all the pieces of a Question tree can be resolved with one API call.


Ah, that explains it. Thanks!

I’m going to have to rethink a chunk of this extension now.