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

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

How to create custom module on Spryker for Backoffice?

Spread the love Creating a custom module in Spryker

How to Install Spryker Project with Docker on Local Machine

Spread the love Spryker is a flexible and scalable commerce

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

bluethinkinc Blogs