Questions tagged [graphql]
The graphql tag has no usage guidance.
78
questions
0
votes
1
answer
7
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
28
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
211
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
30
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
57
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
14
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
14
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?
0
votes
0
answers
29
views
Return Entries that only have children that are active
I'm working with a site I've inherited which uses React to pull Entries from Element API - I've tried to set the criteria to use hasDescendants => true however, I'm still getting Entries with no ...
0
votes
0
answers
53
views
Why using GraphQL to mutate multi site content is affecting the primary page
I'm working on a project that translates the whole website into different languages. Our approach is using GraphQL query to automatically upload the new content for each site (distinguished by site id)...
0
votes
0
answers
12
views
GraphQL Mutation on multi sites changed the primary site's Matrix Blocks and super Table fields content
I'm new to craft CMS. I want to post translated content via GraphQL on different sites. Below is the graphQL query I'm using:
mutation Save($siteId: Int, $postDate: DateTime, $title: String, $slug: ...
0
votes
0
answers
15
views
Make plugin field data available via GraphQL
I have a plugin field which calculates a bunch of data according to a string value and makes it available as an object to admin and front end via the normalizeValue() method in the plugin field class.
...
1
vote
1
answer
54
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
43
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 ...
0
votes
0
answers
88
views
GraphQL category count by slug
I created categories in craft and I'd like to get total amount of entries related to individual category. Right now I have a query that returns my categories:
query categoriesQuery {
categories(...
0
votes
0
answers
46
views
How to access an SVG file via GraphQL
I would like to insert an SVG tag directly into my Markup in order to make changes after the file was uploaded
0
votes
0
answers
12
views
Getting revisions from GraphQL explorer
I am on my GraphQL explorer trying to retrieve all the revisions from a specific entry,
I am able to get the entry but not the revisions flag that appears in the the documentation (https://craftcms....
2
votes
1
answer
41
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
146
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
138
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
123
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
350
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
73
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
165
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
155
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
100
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
114
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
291
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
188
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
168
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
59
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
60
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
504
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
0
answers
101
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
129
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
25
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
169
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
373
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
83
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
288
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
1k
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
38
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
170
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
94
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
76
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
97
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
329
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
489
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
255
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
123
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 ...