Basic GraphQL Query in Magento 2

  Рет қаралды 1,451

Mark Shust

Mark Shust

Жыл бұрын

Want to know how to easily access data within Magento using GraphQL?
Start with an opening bracket `{`. Then type the field that we want to query.
Let's try a basic example using the `availableStores` field. Once we've specified the field, we need to define the fields or properties that we wish to return for this particular query.
Sometimes, we may not know which specific fields or properties are available for querying. In that case, the menu on the right can be very helpful. Click the `Query` link followed by the `availableStores` item to find the available fields we can query. This will reveal an array of `StoreConfig` values.
Now it's time to choose a field from the array to query. Click the `StoreConfig` link to see the list of available fields we can query within this field. For this example, we'll use the `base_url` property.
To execute our query, we simply add `base_url` to our existing query and press the "Execute" button:
{
availableStores {
base_url
}
}
Voila! We get a list of all stored URLs in Magento as a result of our simple query.
This example demonstrates a basic query, but using the same methodology, you can explore querying any data using GraphQL in Magento or Adobe Commerce.
#magento #magento2 #graphql #javascript

Пікірлер: 8
@ramanathanmr4661
@ramanathanmr4661 Жыл бұрын
👌👌👌
@MarkShust
@MarkShust 11 ай бұрын
👌
@venkateshsagar4717
@venkateshsagar4717 Жыл бұрын
Awesome!
@MarkShust
@MarkShust Жыл бұрын
Thanks, glad you liked it!
@rahulbhandary3952
@rahulbhandary3952 9 ай бұрын
Nicely explained 👌👌👌👌
@MarkShust
@MarkShust 9 ай бұрын
Thanks Rahul 😁
@neelchavan7927
@neelchavan7927 3 күн бұрын
Exception #0 (Exception): Warning: Undefined array key "GraphQlOperationNames" in vendor/magento/module-graph-ql/Model/Query/Logger/NewRelic.php on line 52 getting above error on this mutation
@MarkShust
@MarkShust 2 күн бұрын
Sounds like a bug with whatever is the current version of the code you have installed. I'd recommend making sure all of the modules are up-to-date and try again! Or disable the NewRelic logger.
What's New In Magento 2.4.6
10:35
Mark Shust
Рет қаралды 10 М.
Would you like a delicious big mooncake? #shorts#Mooncake #China #Chinesefood
00:30
$10,000 Every Day You Survive In The Wilderness
26:44
MrBeast
Рет қаралды 101 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 157 МЛН
GraphQl in Magento 2 - Introduction - Part 1
22:36
MageDigest
Рет қаралды 6 М.
ChatGPT Made a Magento 2 Module YOU GOTTA SEE
9:39
Mark Shust
Рет қаралды 7 М.
Webhooks in Magento / Adobe Commerce
16:49
Oleksandr (Alex) Lyzun - E-Commerce Geek
Рет қаралды 623
The TRUTH About Third-Party Magento Themes
8:12
Mark Shust
Рет қаралды 1,5 М.
Magento 2 Nightmare? My 5 Reasons to Avoid It
8:21
Mark Shust
Рет қаралды 1,2 М.
What's New in Magento 2.4.7
8:45
Mark Shust
Рет қаралды 4,1 М.
Get Hired in Magento 2! Joseph Maxwell Reveals 8 Tips for Job Interview Success!
15:09
SwiftOtter—BigCommerce and Magento 2 experts
Рет қаралды 1,1 М.
Magento GraphQL and React Integration Part - 1
14:43
Magento GraphQL and React Integration
Рет қаралды 9 М.
Who’s more flexible:💖 or 💚? @milanaroller
0:14
Diana Belitskay
Рет қаралды 18 МЛН
Ultimate Cookie Blizzard 🍦🍦🍦 54
0:10
Ice Cream Man
Рет қаралды 14 МЛН
Backstage 🤫 tutorial #elsarca #tiktok
0:13
Elsa Arca
Рет қаралды 7 МЛН
ДЕНЬ РОЖДЕНИЯ БАБУШКИ #shorts
0:19
Паша Осадчий
Рет қаралды 6 МЛН
ПРИДУМАЛ ГОЛОДНЫЙЕ ИГРЫ ДЛЯ БЕДНЫХ
0:36