OAuth-based Web API calls
Once we have obtained OAuth access token, from the preceding steps, we can start making Web API calls to other methods. Even though the Web API coverage is the same for both REST and SOAP, there is a significant difference when making method calls.
For the purpose of giving a more robust example, we will be targeting the customer group save
method, (partially) defined in the vendor/magento/module-customer/etc/webapi.xml
file as follows:
<route url="/V1/customerGroups" method="POST"> <service class="Magento\Customer\Api\GroupRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Customer::group"/> </resources> </route>
To use the access token to make Web API calls, like POST /V1/customerGroups
, we need to ...
Get Magento 2 Developer's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.