3.1 - 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://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:

$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.

Last updated