Child pages
  • Chapter 2 - Discovery - Testing access to the web service with the browser

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagehtml/xml
titleResult for http://example.com/api/customers
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
  <customers>
    <customer id="1" xlink:href="http://example.com/api/customers/1"/>
    <customer id="12" xlink:href="http://example.com/api/customers/2"/>
    <customer id="13" xlink:href="http://example.com/api/customers/3"/>
    <customer id="14" xlink:href="http://example.com/api/customers/4"/>
    <customer id="15" xlink:href="http://example.com/api/customers/5"/>
    <customer id="16" xlink:href="http://example.com/api/customers/76"/>
    <customer id="17" xlink:href="http://example.com/api/customers/87"/>
    ...
  </customers>
</prestashop>

...

The http://example.com/api/customers/1 example is not only available using the HTTP GET method, but also using POST, PUT, DELETE, HEAD. Therefore, to edit a customer (or any other resource, for that matter), you simply need to GET the XML data for the resource, update it with your changes, and POST the whole XML file to the same URL again. PrestaShop will take care of updating everything in the database.

Example

The XML file found at http://example.com/api/customers/1, whose link is found in the list of resources (see above), gives you the properties of customer account that has "1" as its ID.

...