The api.amica.com.pl service provides Amica's database access in SOAP format. This Web services are described by WSDL files available at:
- https://api.amica.com.pl/?q=ws/wsdl - Authorization, users data and general methods
- https://api.amica.com.pl/?q=ws/wsdl/products - Products data area
Click it to display WSDL in browser or copy and use it in WSDL capable software.
In addition we provide You with human-readable documentation, which is generated from the WSDL file and from comments in it:
To facilitate the implementation, there are three specific calls, that allow you to test communication with the service, starting from the level of the text through a simple XML to full SOAP format.
- https://api.amica.com.pl/?q=test: Returns two-character string OK in text mode.
- https://api.amica.com.pl/?q=ws/test: Returns element <test>OK</test> in XML mode.
- https://api.amica.com.pl/?q=ws [POST: testGet method]: Returns in XML mode, the OK response formatted according to SOAP standard. Below is an example code in PHP language:
$client = new SoapClient("https://api.amica.com.pl/?q=ws/wsdl", $options);
$testResponse = $client->testGet();
echo $testResponse->testValue;
Critical errors are returned by SOAPFault object with HTTP code set to 500 according to the SOAP standard. It is possible to force code 200 by setting parameter http200 to true. The returned object includes always faultcode element, which indicates the cause of the error (ex. Client.Auth.userRange or Server.Auth.Internal) and faultstring element, which is description for technical staff, ex. "Invalid userRange parameter: xxx. Should be 'consumers' or 'partners'".
Non-critical errors are returned by exit status code (ex. dataStatus, loginStatus, updateStatus), which is obligatory element of every data structure returned by the API. The status is set to 0 in case of normal operation or to value greater then zero (1) in case of problems.
If status is no-zero, element statusMessage is also returned. It includes description of situation, designed to be displayed to the end-user, ex. 'Bad login or password, try again'. On case of update-type operations, statusMessage element is also returned in the zero state, as confirmation, ex. 'User data has been saved'.