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

How to Add a Custom Tab to the Customer Order Detail Page in Magento 2

Spread the love Adding a custom tab to the Order Detail

Exception Handling in Java

Spread the love Introduction – Exception:An unwanted

How to add custom less file in Magento2

Spread the love Source files *.css included into layout

Spring Boot Microservices

Spread the love Microservices architecture has become

Implementation of WireMock for better testing

Spread the love WireMock is a flexible and powerful tool

Magento 2: How to selected default option in configurable options?

Spread the love Configurable products in Magento 2 allow

How To Implement Simple JWT Authentication in Django Rest Framework

Spread the love We’ll learn how to use simple JWT

Optimizing Search: Integrating Elasticsearch in Django Applications

Spread the love What is Elasticsearch? Elasticsearch is a

How to create Customer Segments

Spread the love In Magento 2, “customer

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

bluethinkinc Blogs