Questions tagged [graphql]
The graphql tag has no usage guidance.
68
questions
0
votes
1
answer
21
views
trying to insert super table field values using graphql in craft cms
cant able to store values from super table field,need a correct format to do
Graphql
mutation saveEntry($superTable: [demoSuperTable_SuperTableBlockContainerInput] = {demoSuperTable_0: {id: "&...
0
votes
0
answers
18
views
How to filter by date using GraphQL?
I'm looking for some help writing my GQL Query to find all entries that have been updated since a given date.
I'm basically looking for this solution but for CraftCMS. I'm not sure what the structure ...
0
votes
0
answers
17
views
Craft cms with graphql How to make reverse query(In terms of relation)
entries(limit: 50, section: "branches", orderBy: "dateUpdated") {
id
branchTitle: title
... on branches_standard_Entry {
branchAddress: map
bank: ...
1
vote
1
answer
33
views
How to make a external GraphQL API request?
I want to query some data from another domain. I dont want to to do it in JS (client side) because I want the content right in place on the page.
I tried with several options and variations with the ...
0
votes
0
answers
24
views
Getting GraphQL working with Authorization header
In the docs, the following is written:
Apache strips Authorization headers by default, which can be fixed by enabling CGIPassAuth or adding the following to your .htaccess file:
RewriteCond %{HTTP:...
0
votes
0
answers
47
views
How to query relations within Supertable field via GraphQL
I have two Entry types: Albums and Songs. On the Albums entry type, I have a SuperTable field (called tracklist) where you can add tracks and select one Song entry per row.
On the song page, I'd like ...
0
votes
0
answers
33
views
How to upload file via GraphQL
I am unable to find any information about how to upload a file via GraphQL. Any help would be appreciated. This is my mutation at the moment.
mutation saveContactForm($slug: String, $title: String, $...
0
votes
1
answer
66
views
GraphQL - Categories with entries
Is it possible to get categories with related entries with one graphQL query?
I have the following query:
query MyQuery {
categories(relatedToEntries: {section: "entryType"}) {
id
...
0
votes
0
answers
41
views
Is there a WYSIWYG editor field which gives structured data back over GraphQL?
I'm using Craft in headless mode, and I'm building a NextJS application which queries Craft via GraphQL.
I've been evaluating the various different field types I can use to produce a "content ...
0
votes
0
answers
23
views
Local GraphQL requests failing due to SSL issues (unable to get local issuer certificate)
I have a local install of Craft 3 set up as a headless CMS and served via Nitro. I’m pulling in data to Next.js via Apollo GraphQL. I’m able to successfully query Craft for a list of entries from the ...
2
votes
1
answer
22
views
GraphQL IDE doesn't show up in Craft Admin
In config/general.php, I've enabled GraphQL and headless mode like so:
"enableGql" => true,
"headlessMode" => true,
The official docs suggest that there's a built-in IDE for ...
1
vote
1
answer
27
views
Returning Metadata Fields with GraphQL?
I'm trying to pull as much information from the CMS as possible via the GraphQL API. I can't seem to find any info about how to extract the metadata information for the various entries in the CMS.
At ...
0
votes
0
answers
80
views
Maximum Response Size in GraphQL API?
hoping someone can point me in the right direction here.
I'm trying to query my client's API with the Graphiql interface. My use case requires me to extract quite a lot of data from their system but ...
0
votes
0
answers
92
views
Vue Apollo with graphQL bearer authorization
I am trying to get queries from my craft 3 graphql, but I don't want to use the public schema meaning I must use an authorization bearer token. I can't quite figure out how to add my token to get my ...
0
votes
0
answers
33
views
CraftCMS Image Transform returning NULL on asset.url when stored on AWS S3 Bucket
So i'm using Craft as a headless CMS with a React frontend.
When querying assets on a S3 bucket and applying a transform to them in my GraphQL query the URL response is NULL.
This isn't the case when ...
0
votes
0
answers
52
views
Runtime Object type "Element" is not a possible type for "MyGraphqlInterface" for custom gql resolver/interface
So, I'm probably taking the wrong approach here, but I am attempting to write a custom graphQL query interface, resolver, DB and graphQL query classes in order to return values from a custom Plugin ...
1
vote
0
answers
16
views
Same GraphQL query on production (which gives me what I want), results in 504 time-out locally
I have 2 identical installs local and production. Both servers are nearly identical and when checking Utilities > System Report all requirements are met.
When I query for matrix blocks locally, I ...
1
vote
1
answer
50
views
How do I get custom fields of User on graphQL?
I am wanting to fetch queries for custom fields of users, how would I go about doing that?
So if I did something like this:
query {
users {
id
firstName
lastName
email
photo {
...
1
vote
1
answer
134
views
Creating an entry with a matrix field using GraphQL
I am trying to create a new entry in Craft CMS using GraphQL. The entry has a matrix field called "vehicles" that has a single block called "vehicle". This block has a single field ...
1
vote
1
answer
27
views
Language prefix in URL with correct entry URIs
I never used Craft before and I'm trying to create a multi-language site (in headless mode) but am running into problems with adding the language to the URL.
My goal is to have URLs that always start ...
0
votes
0
answers
13
views
Is it possible to invalidate the GraphQL cache for a single query?
I have a pretty large website that benefits greatly from the GraphQL cache, but it seems like it's a single site-wide config in the Craft config/app.php file. I would need to invalidate the cache from ...
0
votes
0
answers
112
views
Graphql: How to get all entries and all related entries
I am really new to graphql and the jamstack-thing but i was wondering how is it possible to query all "Events" with all related "Speaker"?
Events and Speaker are two sections.
In ...
0
votes
0
answers
44
views
Create a structure entry with GraphQL in one trip
I was wondering if it is possible to create a structure with multiple children and nested entry via GraphQL with one mutation query?
For now, I can only create the first level entry of the structure ...
0
votes
0
answers
142
views
How do you create a GraphQL mutation to upload a file for an entry's asset field?
In my mutation I need to upload a file to an Asset Field. Can this all be done in one mutation or do you need to upload the file in one mutation and assign the id to the asset field in a secondary ...
0
votes
0
answers
17
views
Custom GraphQL Resolver that utilizes the same craft function used in twig
I'm pretty new to Craft CMS or PHP for that matter. I have custom code that unfortunately can't be done with just GraphQL so I need to utilize the same functions used in a twig template, in a custom ...
1
vote
1
answer
71
views
Return a single element instead of an array in a GraphQL query
Consider the following GraphQL query:
{
entries {
...on posts_default_Entry {
image {
id
}
}
}
}
This will return the following:
{
"data": {
"...
1
vote
0
answers
26
views
GraphQL next does not accept 'relatedToCategories'
I'm trying to get the next project in the "projects" section but with the same category.
So because I can't do it in one query (the value of my category is in the result), I do another query ...
0
votes
0
answers
25
views
Same table field in two different sections/sites causes GraphQL error
Given this mutation (which adds rows to a table)
mutation {
save_thesection_thetype_Entry (
siteId: 1,
title: "test titel",
...
0
votes
0
answers
31
views
How to set tags via graphQL?
I'm trying to create entries programmatically and setting tags on them. However, I can't figure out if this is possible or not, and can't find documentation explaining this.
I'm basically trying to do ...
2
votes
1
answer
68
views
How to get enabled entry with GraphQL, enabledForSite has been deprecated?
Based on the docs https://craftcms.com/docs/3.x/graphql.html#the-entries-query enabledForSite can be used for entries. This works for me to get the enabled entries, however I get a deprecation error ...
0
votes
0
answers
48
views
Bearer Authorization not working Safari
I'm using craft 3.7.16 as headless and retrieving the data through GraphQL.
I've identified that Safari is not working when we have a bearer authorization. It seems that it changes the bearer to basic ...
0
votes
0
answers
55
views
Get related entries / users filtered by relation field name in GraphQL
I wonder if it's possbile to deal with the following situation with Craft CMS in graphQL:
We have users related to projects in two different ways:
users.bookmarkedProjects = [projectIds]
project....
1
vote
1
answer
36
views
Graphql schema causing error on project-config/apply
Craft v3.5.7
First off, graphql is not being used on this site so I'm not sure why the schemas are being generated and causing errors. The graphql.yml file contents:
publicToken:
enabled: false
...
1
vote
1
answer
63
views
Why can't I see my programmatically-created Entries in GraphQL/GraphiQL?
I am using a module controller to create Entries, like this:
$personEvent = new Entry();
$personEvent->sectionId = 6;
$personEvent->typeId = 1;
$personEvent->authorId = $user->id;
$...
1
vote
1
answer
43
views
Graphql mutations with json
Can someone confirm for me that the current status of craftql (Craft 3.7) does not allow mutations that can save JSON content to entries?
1
vote
1
answer
667
views
How do I write a GraphQL query to search through sub-entries/entries as fields and return the whole entry?
So I have a fairly complex section structure that (on an Entry Type) has a matrix field that contains entries as fields(sub-entry) within a blocktype.
I'd like to write a GraphQL query such that when ...
2
votes
1
answer
185
views
Craft CMS GraphQL count query
I've got the GraphQL code posted below, but I'm not sure how do I count the total of returned products .
Do I need another query just for the products without offset ? I need it for a pagination ...
2
votes
1
answer
369
views
Is it possible to write a custom GraphQL resolver for Craft?
I am currently editing a headless VueJS + Craft + GraphQL website and the client asks me to add a Recipe section. I found https://plugins.craftcms.com/recipe which is great, but when I add the field ...
1
vote
1
answer
142
views
GraphQL: get prev / next entry from current entry (channel)
Is there a way to get the prev and next entry from the current entry, when this entry is inside a channel and not a structure?
query ($id: [QueryArgument], $rel: Int) {
entry: entry(id: $id) {
...
1
vote
1
answer
59
views
GraphQL mutation or query, how to target specific site?
Is there a restriction on graphQL that only allows it to work on the primary site?
My system has for unknown reason switched primary (and I can't change it back due to a bug), and ever since then my ...
1
vote
1
answer
569
views
WARNING: heuristic fragment matching going on! when querying matrix fields or any query with multiple fragment types with Graph QL using Nuxt Apollo
I am relatively new to using Craft Headlessly and am trying to query matrix fields with Nuxt JS and it's Apollo module.
I have discovered, that although the graphQL queries work in the GraphiQl ...
2
votes
2
answers
617
views
Fetching Unique Categories related to Entries via GraphQL
Suppose I have some entries in a section called 'product' that are related to a category call 'brand' - I know I can get the brands that are related to each product that match a search term using ...
2
votes
1
answer
702
views
Updating Entry field with GraphQL mutation
I'm trying out the GraphQL mutations and would like to issue an update of an Entry, triggered from a webhook.
However, documentation on mutations seems sparse, and I find GraphQL highly confusing. ...
4
votes
1
answer
353
views
Using a GraphQL mutation to append a block to a Neo field
I know how to update simple fields on an entry using a mutation:
mutation updateRecipe($recipeId: ID, $slug: String) {
save_recipes_recipe_Entry(id: $recipeId, slug: $slug) {
id
title
...
1
vote
1
answer
137
views
Create folder in asset volume via GraphQL
Is it possible to create a subfolder within an asset volume via GraphQL? If yes, can you point me in the right direction?
I just found mutations for file uploading, but nothing for folder creation.
...
1
vote
1
answer
176
views
How can I have created data (id) returned for a GraphQL mutation?
I have a mutation which is successfully creating an entry, but the data returned for the mutation does not include the fields I specify, such as id.
mutation saveWindowCleaningRequest($title: String!, ...
1
vote
1
answer
268
views
Filter for language when using graphQL
I try to use graphQL to get language specific entries from my Craft CMS. I (naively?) tried this:
query {
entries (section: "newsIntranet", language: "fr") {
title
...
1
vote
1
answer
211
views
Fetch pending entries with GraphQL
I'm setting up Craft to be used headlessly with a mobile app, and content will be created several days before it is published. I want app admins to be able to see upcoming/pending entries. Is there a ...
1
vote
1
answer
3k
views
GraphQL query entries by DateTime field between two dates
I am trying to query entries in GraphQL by custom DateTime field value.
It works with the base String value like ">=2020-10-01",
However querying between two dates like "['and', '>...
1
vote
1
answer
105
views
How can I change the Date Created for Assets?
I'm using graphql to pull in some assets/pdfs and ordering them by dateCreated, however the files go back a few years (i.e. files from 2019, files from 2018 etc.) but they weren't uploaded in the ...