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 include these request parameters in the authorization request header in the call:
oauth_consumer_key
, available from the Magento admin area, under the integration edit screen.oauth_nonce
, random...