How to Get data from database using Graph Ql in Magento 2

Blog
Spread the love

What is a Graph Ql : –

Graph Ql is a query language and server-side runtime that was created back in 2012-2015 by Facebook.

Magento implements Graph Ql to provide an alternative to REST and SOAP web API for frontend development.

Its major aim is speeding up and boosting the API, their flexibility, and their effectiveness.

difference between REST, SOAP API, and Graph Ql lies in the capability of

Graph Ql to obtain clean-cut results in a single call as it needs only one endpoint

REST, on the other hand, normally requires more than one query-send to multiple endpoints in order to achieve the same results

(and most likely these results won’t be as precise as the ones provided by Graph Ql).

Graph Ql is also attractive as a query language due to its approach towards clients. By giving clients the data control, they

have the opportunity to determine what data should be received in the response.

To begin exploring Graph Ql, set the Graph Ql endpoint by entering

http:///graphql in the URL bar of your IDE or extension.

for get data from database using graph Ql need to follow below steps:-

Step1 – Create schema.graphqls file inside

app\code\Vendor\Extension\etc\

and add below code

Step2 – Create Student.php file inside

app\code\Vendor\Extension\Model\Resolver\

and add below code

Now, Test in Postman

extention_2023

That’s it!!

If you have any query please comment

bluethinkinc_blog

bluethinkinc_blog

2023-03-22

0

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

Enhancing Productivity with Dynamics 365: The Power of Session Restore

Spread the love Enhancing Productivity with Dynamics 365:

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

How to Create a Power Apps Component Framework (PCF) with React

Spread the love If youʼve been looking to supercharge your

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

SALESFORCE

Spread the love Salesforce is a cloud-based software

CRUD Operation in Spryker Backoffice with a Custom Module

Spread the love Spryker is a highly flexible and modular

bluethinkinc Blogs