Managing API: Difference between revisions

From osCommerce Wiki
Jump to navigation Jump to search
m (Changed protection level for "Managing API" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) [cascading])
No edit summary
Line 2: Line 2:


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.
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.
[[File:Image 42.png|none|frame]]
[[File:Image 380.png|alt=|none|frame]]
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.'''
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).
'''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).
[[File:Image 43.png|none|frame]]
[[File:Image 379.png|alt=|none|frame]]
Fill in the required data in '''lib/config.php.'''
Fill in the required data in '''lib/config.php.'''
[[File:Image 44.png|none|frame]]
[[File:Image 44.png|none|frame]]

Revision as of 16:53, 26 November 2021

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>