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…
Author: Bikash
Manage Fastly VCL snippets using the API
Delete a snippet 1. Save Fastly service credentials as bash environment variables export FASTLY_SERVICE_ID=<Service ID> export FASTLY_API_TOKEN=<API Token> 2. Check active VCL version curl -H “Fastly-Key: $FASTLY_API_TOKEN” https://api.fastly.com/service/$FASTLY_SERVICE_ID/version/active 3. Save active version number returned in the “number” key export FASTLY_VERSION_ACTIVE=<version> 4. Clone active VCL version and all snippets curl -H “Fastly-Key: $FASTLY_API_TOKEN” https://api.fastly.com/service/$FASTLY_SERVICE_ID/version/$FASTLY_VERSION_ACTIVE/clone -X PUT 5. Save the…
How to redirect to previous page in Magento 2
In Magento 2, You can redirect to the previous page. This allows customers to redirect back to the page from where the customer came. In Your Controller write the following code: <?php namespace Company\Module\Controller\Index; use Magento\Framework\Controller\ResultFactory; class Actionname name extends \Magento\Framework\App\Action\Action { public function execute() { $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); //your code work around here $resultRedirect->setUrl($this->_redirect->getRefererUrl());…
Useful Git Commands
Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Here are some of git useful commands that you can use frequently on Github bash. git remote -v git remote remove origin git remote add origin Bitbucket_Repository_URL git diff –stat –cached…
How to use Dependency Injection (DI) in Magento 2
Dependency injection is the idea that a class is given the classes that it needs in the __construct method. Magento uses constructor dependency injection. In your __construct method, you list classes that you want to be injected and Magento’s DI system will do that for you. public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig ){ $this->scopeConfig = $scopeConfig;…