How to get Admin Token by Rest API V1/integration/admin/token in Magento 2?

How to Get Admin Token by REST API in Magento 2?

Magento 2 Admin Token REST API, you need to first generate an access token. The access token is used for synchronization with Magento to another third-party platform.

Without an Access token, you can’t communicate with Magento 2 API that requires Admin Token to fetch results.

To create an access token you need to call POST action with Request payload. Your request URL will be rest/V1/integration/admin/token append to your site URL.

You can check at the end of the page for the POSTMAN screenshot to fetch the access token with POSTMAN.

Continue reading “How to get Admin Token by Rest API V1/integration/admin/token in Magento 2?”

Create a Custom REST API for Bulk product update in Magento 2.

Native Magento comes with a lot of REST APIs for different Entities like Product, Order, Customer, and other APIs.

I want to give a demo for updating bulk products using rest API in Magento 2.

By Default Native Magento doesn’t provide Bulk Product Update API. You need to call REST API to iterate over a loop. At a time you can update only a single product. Continue reading “Create a Custom REST API for Bulk product update in Magento 2.”

How to update order status using Rest API Magento 2?

We can update Order status using REST api in Magento 2 by just simple payload. For Create Order, Create order using rest api in Magento 2
We required the order_id, order status, and order_incrementid for update order status.
Request:{YOUR_URL}/rest/V1/orders

Type: POST

Body:

POST
{
  "entity":{
    "entity_id":10,
    "status":"processing",
    "increment_id":"000000010"
  }
}

Response:

{
    "base_grand_total": null,
    "base_total_due": 0,
    "billing_address_id": 204,
    "created_at": "2018-09-16 18:12:42",
    "customer_email": null,
    "entity_id": 10,
    "grand_total": null,
    "increment_id": "000000010",
    "protect_code": "352f3f47cd42aa50f0e7e328ffd53040",
    "status": "processing",
    "total_due": 0,
    "updated_at": "2018-09-16 18:44:57",
    "items": [
        {
            "amount_refunded": 0,
            "base_amount_refunded": 0,
            "base_cost": 0,
            "base_discount_amount": 4.5,
            "base_discount_invoiced": 0,
            "base_original_price": 45,
            "base_price": 45,
            "base_price_incl_tax": 45,
            "base_row_invoiced": 0,
            "base_row_total": 45,
            "base_tax_amount": 0,
            "base_tax_invoiced": 0,
            "created_at": "2018-09-16 18:12:42",
            "discount_amount": 4.5,
            "discount_invoiced": 0,
            "discount_percent": 10,
            "free_shipping": 0,
            "is_virtual": 0,
            "item_id": 124,
            "name": "Push It Messenger Bag",
            "no_discount": 0,
            "order_id": 103,
            "original_price": 45,
            "price": 45,
            "price_incl_tax": 45,
            "product_id": 14,
            "product_type": "simple",
            "qty_backordered": 0,
            "qty_canceled": 0,
            "qty_invoiced": 0,
            "qty_ordered": 1,
            "qty_refunded": 0,
            "qty_returned": 0,
            "qty_shipped": 0,
            "row_invoiced": 0,
            "row_total": 45,
            "row_total_incl_tax": 45,
            "row_weight": 0,
            "sku": "24-WB04",
            "store_id": 1,
            "tax_amount": 0,
            "tax_invoiced": 0,
            "tax_percent": 0,
            "updated_at": "2018-09-16 18:12:42",
            "weight": 0
        }
    ],
    "billing_address": {
        "address_type": "billing",
        "city": "Ahmedabad",
        "company": "Rbj",
        "country_id": "US",
        "email": "rakesh@rakeshjesadiya.com",
        "entity_id": 204,
        "firstname": "rakesh",
        "lastname": "jesadiya",
        "parent_id": 103,
        "postcode": "30332",
        "region": "Georgia",
        "region_code": "GA",
        "region_id": 19,
        "street": [
            "Street 1",
            "Street 2"
        ],
        "telephone": "123456"
    },
    "payment": {
        "account_status": null,
        "additional_information": [
            ""
        ],
        "cc_last4": null,
        "entity_id": 103,
        "method": "cashondelivery",
        "parent_id": 103
    },
    "status_histories": []
}