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

how to get product list catalog through magento 2 api

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.

using magento 2 rest api

For example:

get catalog api magento 2

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:

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.

get product list in magento 2

For example:

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:

Related Posts:

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

How To Get Categories Through Magento 2 REST API?

Leave a Reply

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