Managing API

From osCommerce Wiki
Jump to navigation Jump to search

Note: This manual is for osCommerce v4.

After you accessed the admin area of your website click on Sales channels tab. Under the Physical tab click on the required sales channel and then on Edit button.

Scroll it down to view/update API Access section. You can manage the options in this section by switching them off/on as well as copy Soap Service Url (for PHP), Soap Service Url (for .NET) and copy/regenerate API Key.

Note: For the full access (in most cases for import/export) switch on Site Access Permission (if it is swithced off you will get less information, by default it is switched off).

Fill in the required data in lib/config.php.

Image 44.png

We would recommend to use SoapUI in order to check how API works.

https://www.soapui.org/downloads/soapui.html

Pro version is not required, it is enough to have the free version "SoapUI Open Source".

In SoapUI queries indicate api_key (soapenv:Header should somehow be as follows). For example:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Platformwsdl">

<soapenv:Header><auth><api_key>API_KEY</api_key></auth></soapenv:Header>

<soapenv:Body>

<urn:getProduct soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<productId xsi:type="xsd:int">679</productId>

</urn:getProduct>

</soapenv:Body>

</soapenv:Envelope>