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

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

Google Ads Conversion Tracking Through Magento Platform:

Spread the love Google Ads Conversion Tracking Through

Object Pool Pattern in Magento2

Spread the love What is Object Pool Pattern in Magento 2 An

JENKINS

Spread the love JENKINS Introduction and Installation

Virtual Type and Type

Spread the love Virtual type is one of the most common

Customize the length of Input field

Spread the love Sometimes we need to change the limit the

How to Add Custom Tab on Admin Dashboard and Count Website Total Visitor in Magento 2?

Spread the love In this blog we’ll see How to Add Custom

How to Add Sign Out Tab in Customer Account in Magento 2?

Spread the love In this blog we’ll see How to Add

How to create custom tab in product detail page in magento 2?

Spread the love In this blog we’ll see how to add

Understanding and Implementing CORS & CSRF

Spread the love What is security? The world has become more

bluethinkinc Blogs