Latest news

How To Get Product List (Catalog) Through Magento 2 API?

No comments

Today, we will learn how to get the product list from a Magento 2 website by using the REST API and GraphQL.

1. Get Product List Data With REST API

You can use a tool to access the API. Here we are using Postman.

To get product list data, we need to get the access token of the admin user:

Endpoint: “http(s)://”

Method: POST


	"username" : "string",
	"password" : "string"

Response: “token” (string)

get product list magento 2 api

Magento system will check whether that username is available or not, then the API will return the access token as a string.

For example:
using magento 2 rest api

If your username and password are incorrect, the API will return an error like the following:

After having the access token, we can get product list information from the API.
Endpoint: “http(s):// products”
Method: GET
Request: searchCriteria.
Header: Authorization: Bearer (Token)
Response: token(string)
For example:
get catalog api magento 2

If the access token is correct, the API will return the customer’s information.

For example:

If the access token is incorrect, the API will return an error.

For example:
get product list in magento 2

That’s how we can get the product list data using the Magento REST API.

2. Get Product List Data With GraphQL

Now, let’s move on to getting the catalog information using Magento 2 GraphQL.
Endpoint: “http(s):// products”

Method: POST

Syntax:  products(
    search: String
    filter: ProductFilterInput
    pageSize: Int
    currentPage: Int
    sort: ProductSortInput
): Products

Request example:

First, write down the endpoint and your request:

    filter: { sku: { like: "24-WB%" } }
    pageSize: 20
    currentPage: 1
    sort: { name: DESC }
  ) {
    items {
    filters {
      filter_items {

Get Product Info Using REST API In Magento 2


    "data": {
        "products": {
            "total_count": 26,
            "items": [
                    "name": "BUNDLE: Tiny Round \"Design Your Own\" Children's Necklace for Girls (50+ Optional Charms & FREE Engraving)",
                    "sku": "Tiny Round",
                    "price": {
                        "regularPrice": {
                            "amount": {
                                "currency": "USD",
                                "value": 439.78
            "page_info": {
                "page_size": 25,
                "current_page": 1

Now click run to send the request to the server.
API will return a response which has data like this:

1 Star2 Stars3 Stars4 Stars5 Stars (15 votes, average: 5.00 out of 5)

Related Posts:

Download Free Magento 2 API (GraphQL, REST, SOAP) For Mobile Apps

How To Create API Request In Magento 2?

How To Use Stripe Connect With Custom Account (Vendor Account) In Magento 2?

How To Configure REDIS In Magento 2 & Magento 1? (5 Minutes)

How To Use Custom Local Storage & Cookie Storage In Magento 2?

April LeeHow To Get Product List (Catalog) Through Magento 2 API?

Leave a Reply

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