Questions tagged [graphql]
The graphql tag has no usage guidance.
70
questions
0
votes
0
answers
54
views
Craft cms[4.x]: Frontend Site broke after performing a feed with feed me
On our last data migration from wordpress i import through feed me all the data but the postDates.
31-08-2023 11:12 I imported a csv file in feed me with all the posts content including the postDates ...
1
vote
2
answers
60
views
GraphQL queries for srcset
I am trying to fetch srcset with GraphQL from Craft4 but I don't really understand the syntax. In my twig Templates I use image.getSrcset(['1x','2x'],'myTransformHandle') and I'm trying to translate ...
1
vote
1
answer
175
views
CraftCMS headless / Nuxt - not getting live preview to work
Over the past few weeks I've been working on a headless CraftCMS integration with Nuxt for the frontend. I use Apollo and GraphQL to fetch the data from the CMS. Almost there now, but there's one ...
0
votes
0
answers
36
views
Import Image on Matrixblock via GraphQL Mutation
I'm trying to create an Entry via a GraphQL mutation. The whole Entry consists of one Matrix(handle: siteimportmatrix ) with one Block(handle: importblock ) which has 4 fields one of the fields is an ...
0
votes
0
answers
37
views
ETIMEDOUT on graphql requests
I'm using craft's graphql to generate a static site with a nuxt frontend. The generator manages to generate about 40 routes, then it returns
Error: Network error: request to https://geo-api....
1
vote
1
answer
63
views
Get custom fields data on GraphQL
I have several custom fields on craftcms (cp/settings/fields), and some of them are dropdowns.
I'm trying to get this custom fields data (for example the dropdown options) on graphql, because we are ...
0
votes
0
answers
89
views
GraphQL send Authorization headers with nginx
I am trying to write some mutations via GraphQL. For that I need to authenticate via headers. In this case I want to send an authorization header like
Authorization: Bearer xxxxxx-my-token-xxxxx
The ...
1
vote
1
answer
2k
views
With GraphQL why am I getting the error "Cannot query field \"save_personEvents_default_Entry\" on type \"Mutation\". "?
In Craft 3 I am trying to use GraphQL to mutate an existing entry in the section PersonEvents.
Here is what I have in PHP
$mutation = <<<QUERY
mutation saveEntry(\$id: ID, \$avatarUrls: ...
0
votes
0
answers
113
views
Is there a way to add deeper nested arguments to GraphQL in Craft CMS?
Is there a way to add functionality to GraphQL in Craft CMS? Currently, I am fetching product from a GraphQL endpoint, but I only want to receive products which have a category (productCategory) where ...
1
vote
1
answer
102
views
Fetch Category Field Value on Entry Element
I am fairly new to Craft; I have an entry type with a custom field that is a Categories field. I am trying to use GraphQL to return the fields on my entry, including the category field value.
Ex. my ...
0
votes
0
answers
40
views
Execute GraphQL query from module on full schema
I know Craft adds a gql function to twig that enables us to load data from the cms in json format into our templates. What is the best way of achieving the same thing in the context of a module?
I am ...
1
vote
1
answer
19
views
Is there a way to mutate categories through GraphQL for a specific siteId?
The graphQL does not support siteId parameter in category mutation. How could I mutate the content for a specific siteId?
1
vote
1
answer
175
views
GraphQL - Optional relatedTo value
I have a component which lists events and can be configured to filter by category.
Query:
query Events($filter: [String]) {
entries(
section: "event"
relatedToCategories: {group: &...
1
vote
1
answer
55
views
GraphQL fields with applied typogrify - any suggestions?
we love CraftCMS and also typogrify plugin with Twig filter "|typogrify".
Now we are starting a web project that will combine Astro and CraftCMS will be used headless with the use of GraphQL ...
2
votes
1
answer
103
views
Adding section to Graphql "View - Public Schema" programatically
So, I am creating new section called "My Section" with handle "mySection" via plugin. All good there.
I want to be able for my section to be Viewable via Public Schema each time it ...
1
vote
1
answer
320
views
How to get a list of entry types for a section using GraphQL?
The goal is to get a list of entry types for a section, so that a user can filter entires by entry type e.g.
query Entries {
entries(section: "content", type: ["news", "...
1
vote
1
answer
379
views
GraphQL query orderBy number including null
I am attempting to query entries via that have a field (ex numberField) with field type Number. Some of the entries don't have a value for this field, so in the response it has null. I am wanting to ...
0
votes
1
answer
217
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: "&...
1
vote
1
answer
260
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
360
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
1
answer
433
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
...
2
votes
1
answer
93
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
74
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
752
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 ...
1
vote
1
answer
175
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 ...
1
vote
1
answer
227
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
33
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
244
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
582
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
200
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
1
answer
403
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 ...
1
vote
1
answer
3k
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": {
"...
2
votes
0
answers
53
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 ...
2
votes
1
answer
270
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 ...
1
vote
1
answer
154
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
86
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
134
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
1k
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
480
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
576
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
377
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
170
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
2
answers
731
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
1k
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
1k
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
500
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
214
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
259
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!, ...
2
votes
1
answer
476
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
406
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 ...