Magento 2 admin token using Rest API & CURL

Magento access token is used to synchronize and work with any third-party applications.

Using the Magento Rest API provided, you can create, authenticate, and remove a token and its access.

************* curl POST HTTP token authentication ****************
curl -XPOST -H 'Content-Type: application/json' http://magento231.local/rest/V1/integration/admin/token -d '{ "username": "admin", "password": "admin@123" }'

************* curl GET HTTP token authentication ****************
curl -X GET "http://www.magento231.local/rest/all/V1/store/storeViews" -H "accept: application/json" -H "Authorization: Bearer 0kze3s5uy6vwn8fvzt6e23gwbwhrj72i"

************* curl PUT HTTP token authentication ****************
curl -X PUT "http://www.magento231.local/rest/all/V1/eav/attribute-sets/1" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer 0kze3s5uy6vwn8fvzt6e23gwbwhrj72i" -d "{ \"attributeSet\": { \"attribute_set_id\": 0 }}"

************* curl DELETE HTTP token authentication ****************
curl -X DELETE "http://www.magento231.local/rest/all/V1/eav/attribute-sets/1" -H "accept: application/json" -H "Authorization: Bearer 0kze3s5uy6vwn8fvzt6e23gwbwhrj72i"

 

Leave a Reply