How to Get New Arrival Product REST API in Magento 2

In this article, we will learn how to filter the products of a Magento 2 store using the REST API and we will also know how to get new arrival products REST API.

By the way, Magento 2 Provides a facility for the REST API that is well known as Swagger Module which contains all list of REST APIs resources:

Using this model, you can get the product by visualizing and testing it through REST API.

When you hit the URL of your store by typing swagger you will get the list details of all the APIs.

Like I have taken an example below, according to this example you enter your URL and hit it, then you will get the API.

Endpoint:

http://www.wishusucess.com/swagger

Here we are filtering the product on the basis of attribute and the name of that attribute is a new product.

So while filtering the product through Rest API, we will get the newly added product by filtering

 

 

Get New Arrival Products REST API

 

To filter a new product, what should be its search criteria and which method will be used, what access token will be used, the details of all these are given below.

Endpoint

https://www.wishusucess.com/rest/V1/products?searchCriteria[sortOrders][0][field]=created_at&searchCriteria[pageSize]=10

Method: GET

Header: 

  • Authorization: Bearer <admin token>
  • Content Type: application/json

Body: none

New Arrival Products REST API

Search Parameter for New Arrivals in REST API

 

Created At New Arrivals

Response:

{
"items": [
{
"id": 2007,
"sku": "WSH08-31-Purple",
"name": "Sybil Running Short-31-Purple",
"attribute_set_id": 10,
"price": 44,
"status": 1,
"visibility": 1,
"type_id": "simple",
"created_at": "2021-12-23 09:40:40",
"updated_at": "2021-12-23 09:40:40",
"weight": 1,
"extension_attributes": {
"website_ids": [
1
],
"category_links": [
{
"position": 0,
"category_id": "28"
},
{
"position": 0,
"category_id": "35"
},
{
"position": 0,
"category_id": "2"
}
]
},
"product_links": [],
"options": [],
"media_gallery_entries": [
{
"id": 3353,
"media_type": "image",
"label": "",
"position": 1,
"disabled": false,
"types": [
"image",
"small_image",
"thumbnail"
],
"file": "/w/s/wsh08-purple_main_1.jpg"
},
{
"id": 3354,
"media_type": "image",
"label": "",
"position": 2,
"disabled": false,
"types": [],
"file": "/w/s/wsh08-purple_back_1.jpg"
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "/w/s/wsh08-purple_main_1.jpg"
},
{
"attribute_code": "small_image",
"value": "/w/s/wsh08-purple_main_1.jpg"
},
{
"attribute_code": "thumbnail",
"value": "/w/s/wsh08-purple_main_1.jpg"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "url_key",
"value": "sybil-running-short-31-purple"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "category_ids",
"value": [
"28",
"35",
"2"
]
},
{
"attribute_code": "description",
"value": "<p>Fortunately, it's okay to look cute while you're working out. The Sybil Running Short combines a fun, color-blocked design with breathable mesh fabric for sporty-fun style.</p>\n<p>&bull; Blue running shorts with green waist.<br />&bull; Drawstring-adjustable waist.<br />&bull; 4\" inseam. Machine wash/line dry.</p>"
},
{
"attribute_code": "size",
"value": "174"
},
{
"attribute_code": "color",
"value": "57"
}
]
}
],
"search_criteria": {
"filter_groups": [],
"sort_orders": [
{
"field": "created_at",
"direction": null
}
],
"page_size": 1
},
"total_count": 2046
}

 

Similar Posts:

Create Account REST API : How to Create an Account of Customer, Admin

Magento 2 Login REST API: How to Login Customer, Admin

Wishusucess on GitHub