Magento supports both SOAP (short for Simple Object Access Protocol) and REST (short for Representational State Transfer) types of communication with the Web API. Authentication methods themselves are not really bound to any of them. We can use the same authentication method and Web API method calls with both SOAP and REST.
Some of the REST specifics we might outline as follows:
HTTP
verbs: GET
, POST
, PUT
, or DELETE
.HTTP
header requires an authorization parameter, specifying the authentication token with the Bearer HTTP authorization scheme, Authorization: Bearer <TOKEN>
. <TOKEN>
is the authentication token returned by the Magento token service.HTTP
header Accept: application/<FORMAT>
, where <FORMAT>
is either JSON or XML.Some of the SOAP specifics we might outline as follows:
http://<magento.host>/soap/<optional_store_code>?wsdl&services=<service_name_1>,<service_name_2>
.http://<SHOP-URL>/soap/default?wsdl_list
in the browser.The following REST and SOAP examples will make extensive use of cURL, which is essentially a program that allows you to make HTTP requests from the command line or different language implementations (like PHP). We can further describe cURL as the console browser, or our view source tool for the web. Anything we can do with various fancy REST and SOAP libraries, we can do with cURL as well; it is just considered to be a more low-level approach.
Doing SOAP requests with cURL or anything else that does not have WSDL/XML parsing implemented internally is cumbersome. Thus, using PHP SoapClient or something more robust is a must. SoapClient is an integrated, actively maintained part of PHP, and is thus generally available.
With negative points being pointed, we will still present all of our API calls with console cURL, PHP cURL, and PHP SoapClient examples. Given that libraries abstract so much functionality, it is absolutely essential that a developer has a solid understanding of cURL, even for making SOAP calls.
18.219.86.155