Access the web service
In this section we will see how to access the web service via the PHP library.
First, you must create a PrestaShopWebservice
instance that takes 3 parameters in its constructor:
- The store's root path (ex: [ |http://www.google.com/url?q=http%3A%2F%2Fstore.com%2F&sa=D&sntz=1&usg=AFQjCNFhj_6BrnOgA6OlRhMq_T1CxcjGRA]http://store.com/ )
- The authentication key (ex: ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT)
- A Boolean indicating whether the Web service must use its debug mode
If you do not understand the terms of object-oriented programming such as instance, method, or constructor, that's okay for the rest of the tutorial. Here's how you create a Web service call:
Code Block |
---|
$webService = new PrestaShopWebservice( 'http://mystore.com/', 'ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT', false ); |
Once the instance is created, you can access the following methods:
Method | HTTP equivalent |
---|---|
get | (GET) |
add | (POST) |
edit | (PUT) |
delete | (DELETE) |
We will develop the use of these methods in other parts of the tutorial.