Graphql Service Query

Hi Sebastian,

In the old structure, graphql service could be called over the controller with query & params.
With the new build you moved it to the middleware layer.

I need to make a graphql call with a text query from inside the code as before.

For example:

var (hasError, response) = await graphQl.QueryAsync(Context, query);

can you help me on how to do it? (for a module I developed myself)

Thank you.


  • [ ] Self hosted with docker
  • [x] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: [5.7]


  • [x] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

There is a graphql service that is invoked by the service, perhaps you just use that directly, e.g. by injecting IDocumentExecutor.

I don’t know much about this subject.There is an emergency for me and I am trying to work it… Can you help me how to do it? If this is easy for you to do and I would be very happy if you could help.

Actually, I messed around a bit and figured it out. but it takes the x-language parameter via the header and I couldn’t understand how it is used. How do I specify it on the DocumentExecuter when calling the query?

Could you please add a method where we can run a custom query and add a language selection for flatData? A method like this on IGraohQLService would be great.

What exactly are you working on?

I have a module that I am developing. It calls the graphql queries that I recorded through an interface in the background, calls the data with the model name graphqls and retrieves the data and returns the model as a dictionary. I use this data in web page development. These modules I have developed have been developed embedded in squidex.

Entities and Models structures are integrated into the project, so I need to call graphql from the inside. I was able to do this easily in older versions. But now I need to both call graphql and set x-language information.

Example method call I want to make:
graphqlQueryService.execute(graphqlQuery, xLanguage) etc.

I see.

Even though if I would provide this there would be no guarantee that it stays in the code. I have decided a while ago that I don’t want to maintain a stable plugin interface as it is too much effort.

I understand. Is it possible for you to send me sample codes so that I can write a method as I said, even if it is temporary? I tried but I couldn’t. It is very important to me. I would really apreciate if you help. all i need is to make a call with query and language as i mentioned and get results.

Perhaps, but not today. It is not a 5 min task.

thanks a lot, when can we work for this? I’m putting the project on hold because of this development. my intention is just to find out when you are available

I’m waiting for your good news. thank you so much in advance…

I think I have time this afternoon, but I cannot promise it.

1 Like

I’m waiting for good news, because I don’t know the time differences in the countries we live in, I keep my eyes and ears on the news I will give here. :pray:

I will try my best. There is an open bug that has higher priority.

using System.Threading.Tasks;
using Squidex.Domain.Apps.Entities;
using Squidex.Domain.Apps.Entities.Contents;

namespace Squidex.Extensions.Samples.GraphQL
public sealed class GraphQLTestCode
private readonly IAppProvider appProvider;
private readonly IContentQueryService contentQueryService;

    public GraphQLTestCode(
        IAppProvider appProvider,
        IContentQueryService contentQueryService)
        this.appProvider = appProvider;
        this.contentQueryService = contentQueryService;

    public async Task DoSomething()
        var app = await appProvider.GetAppAsync("my-app");

        var context = Context.Admin(app).Change(b => b

        var contents = await contentQueryService.QueryAsync(context, "my-schema", Q.Empty.WithODataQuery("$filter=data/foo/iv eq '123'"));


Hi, unfortunately I can’t use it. because we are recording graphql queries in the background. I need to run direct queries with language selection.

My sample data:
“name”: “demographql”,
“query”: “query { abcDataContents { flatData { title } } }”,

and i need to graphqlQueryService.Run(myData.query, language // en, fr etc.)

system call to graphql with my query and flatData x-language…

I need a method like this. I would be very happy if you could help me with this.

What do you mean with recording?

The graphql endpoint also uses IContentQueryService internally. If you do not make complicated joins you have almost no advantage from using GraphQL. The language fallbacks for example are also part of IContentQueryService .

I’m storing graphql queries on an entity I created myself. Then I use these stored queries for automatic invocation in some parts of my system that I have integrated. I prefer Graphql queries because they contain relationships and it is convenient to write these queries. It is not possible for me on IContentQueryService.

How can we go about doing what I’m talking about.

Thank you.

You can try to just invoke the API directly. It is much slower but might be acceptable.

Is it impossible to do it from within the code? Or does it take too long to do? Because performance is important to me no matter what, I use these graphql records for web site and it is unacceptable that it affects performance.

If you guide me on this, I want to do it even if it is very difficult, but when I tried to do it directly with my own knowledge, I could not succeed.