LogoLogo
Homepage
  • Documentations for PrestaShop 1.4
  • English documentation 1.4
    • Getting Started
    • Updating PrestaShop
    • User Guide
      • Training
      • Customizing your shop
      • Browsing the front-office
      • Connecting to the PrestaShop back-office
      • Adding Products and Product Categories
      • A Look inside the Catalog
      • Managing Customers
      • Managing Orders
      • Managing Payment Methods
      • Managing Shipping
      • Understanding Statistics
      • Managing Modules
      • Managing Employees
      • Understanding the Preferences
      • Exploring PrestaShop's Tools
      • PrestaShop Support
    • System Administrator Guide
    • Developer Guide
      • Developer tutorials
        • Using the REST webservice
          • Chapter 1 - Creating Access to Back Office
          • Chapter 2 - Discovery - Testing access to the web service with the browser
          • Chapter 3 - First steps - Access the Web service and list client
            • 3.1 - Access the web service
            • 3.2 - Handling errors
            • 3.3 - List clients
          • Chapter 4 - Retrieve Data - Retrieving a Client
          • Chapter 5 - Modification - Update client
          • Chapter 6 - Creation - Remote Online Form
          • Chapter 7 - Removal - Remove customer accounts from the database
          • Chapter 8 - Advanced Use
          • Cheat-sheet - Concepts outlined in this tutorial
        • Understanding and using hooks
        • Synchronization via Hooks
        • Modules, Classes and Controller Override
        • Modules, Override, Web Service
        • Db class good practices for Prestashop 1.4
        • Carrier modules - functions, creation and configuration
        • Creating your own payment module
        • Accelerated Security Course - Episode 1 - Never Trust Foreign Data
        • Accelerated Security Course - Episode 2 - SQL Injections
        • Accelerated Security Course - Episode 3 - XSS
        • Accelerated Security Course - Episode 4 - CSRF
      • Fundamentals
      • Creating a PrestaShop module
      • Development standard
      • Public and overloadable methods
      • Web-service reference
      • How to use the forge to contribute to PrestaShop
      • Rocky's guides
        • PrestaShop 1.4.3 Development Guide
          • Architecture
          • Overriding Files
          • Creating Modules
          • Cookie Structure
          • Database Structure
        • PrestaShop 1.4.3 Performance Guide
    • Designer Guide
      • Coding a theme
      • Design tips
      • Implementing layered navigation in a theme
    • Troubleshooting
    • FAQ
    • User contributions
    • Documentation PDFs
  • Documentation française 1.4
    • Guide de dĂ©marrage
    • Mettre Ă  jour PrestaShop
    • Guide de l'utilisateur
      • Formation
      • Personnaliser votre boutique
      • Se connecter au back-office de Prestashop
      • Ajouter des produits et des catĂ©gories de produits
      • Un aperçu du catalogue
      • GĂ©rer les clients
      • GĂ©rer les commandes
      • GĂ©rer les mĂ©thodes de paiement
      • GĂ©rer le transport
      • Comprendre les statistiques
      • GĂ©rer les modules
      • GĂ©rer les employĂ©s
      • Comprendre les prĂ©fĂ©rences
      • Explorer les outils de PrestaShop
      • Obtenir de l'aide
    • Guide de l'administrateur système
    • Guide du dĂ©veloppeur
      • Fondamentaux
      • CrĂ©er un module PrestaShop
      • Tutoriels pour dĂ©veloppeurs
        • Tutoriel Webservice REST
          • Chapitre 1 - Mise en place - CrĂ©ation des accès dans le Back Office
          • Chapitre 2 - DĂ©couverte - Tester l'accès au service web avec le navigateur
          • Chapitre 3 - Premiers pas - AccĂ©der au service web et lister les clients
            • 3.1 AccĂ©der au service web
            • 3.2 Gestion des erreurs
            • 3.3 Lister les clients
          • Chapitre 4 - RĂ©cuperer des donnĂ©es : RĂ©cupĂ©rer un client
          • Chapitre 5 - Modification : Mettre Ă  jour un client
          • Chapitre 6 - CrĂ©ation : Formulaire d'ajout Ă  distance
          • Chapitre 7 - Suppression : Retirer des comptes client de la base
          • Chapitre 8 – Utilisation avancĂ©e
          • Chapitre 9 - Gestion des images
          • Chapitre 10 - Gestion des prix
          • MĂ©mento : Notions Ă©noncĂ©es dans ce tutoriel
        • Mieux comprendre et utiliser les hooks
        • La synchronisation via les Hooks
        • Surcharge et override
        • Modules, surcharge, web service
        • Les bonnes pratiques de la classe Db sur Prestashop 1.4
        • Les modules transporteurs - fonctionnement, crĂ©ation, configuration
        • Cours de sĂ©curitĂ© accĂ©lĂ©rĂ© no. 1 - Never trust foreign data
        • Cours de sĂ©curitĂ© accĂ©lĂ©rĂ© no. 2 - Injections SQL
        • Cours de sĂ©curitĂ© accĂ©lĂ©rĂ© no. 3 - XSS
        • Cours de SĂ©curitĂ© accĂ©lĂ©rĂ© no. 4 - CSRF
    • Guide du designer
      • Conseils en design
      • CrĂ©er un thème
    • Guide du Vendeur
    • Import Wiki FR
      • DĂ©pannage
        • Changer la taille maximum de tĂ©lĂ©chargement de fichiers
        • Comment ajouter une page Ă  PrestaShop
        • GĂ©nĂ©rer le fichier .htaccess par Prestashop pour avoir des URLs simplifiĂ©es
        • GĂ©nĂ©rer un nouveau mot de passe manuellement
        • Import CSV
        • Personnalisation des mails clients
        • Problème d'allocation mĂ©moire chez 1&1
        • Problème pour se connecter après avoir effacĂ© une langue
        • Votre site ne rĂ©pond plus, une page blanche s’affiche
      • FidĂ©liser les Clients
      • Gestion des Taxes
      • Installer Un Module
      • Sauvegarder votre Base de DonnĂ©es
    • PDF de la documentation
    • Contributions des utilisateurs
    • Questions frĂ©quentes
  • DocumentaciĂ³n española 1.4
    • IntroducciĂ³n
    • ActualizaciĂ³n de PrestaShop
    • GuĂ­a de Usuario
      • Entrenamiento
      • PersonalizaciĂ³n de su tienda
      • ExploraciĂ³n del front-office
      • ConexiĂ³n al back-office PrestaShop
      • Añadir Productos y CategorĂ­as de Productos
      • Una Mirada Dentro del CatĂ¡logo
      • GestiĂ³n de Clientes
      • GestiĂ³n de Pedidos
      • GestiĂ³n de MĂ©todos de Pago
      • GestiĂ³n de EnvĂ­o
      • ComprensiĂ³n de las EstadĂ­sticas
      • GestiĂ³n de MĂ³dulos
      • GestiĂ³n de Empleados
      • ComprensiĂ³n de Preferencias
      • ExploraciĂ³n de las herramientas de PrestaShop
      • Soporte PrestaShop
    • GuĂ­a del Administrador del Sistema
    • GuĂ­a del Desarrollador
      • Aspectos Fundamentales
      • CreaciĂ³n de un mĂ³dulo de PrestaShop
      • EstĂ¡ndares de desarrollo
      • Manuales de desarrollador
        • UtilizaciĂ³n del servicio web REST
          • CapĂ­tulo 1 - CreaciĂ³n de Acceso al Back Office
          • CapĂ­tulo 2 - Descubrimiento - Pruebas de acceso al servicio web con el navegador
          • CapĂ­tulo 3 - Primeros pasos - Acceso al servicio Web y lista de clientes
            • 3.1 - Acceso al servicio web
            • 3.2 - Manejo de errores
            • 3.3 - EnumeraciĂ³n de clientes
          • CapĂ­tulo 4 - RecuperaciĂ³n de datos - RecuperaciĂ³n de un cliente
          • CapĂ­tulo 5 - ModificaciĂ³n - ActualizaciĂ³n de cliente
          • CapĂ­tulo 6 - CreaciĂ³n - Formulario En LĂ­nea Remoto
          • CapĂ­tulo 7 - EliminaciĂ³n - Eliminar cuentas de clientes de la base de datos
          • CapĂ­tulo 8 - Uso avanzado
        • ComprensiĂ³n y uso de hooks
        • SincronizaciĂ³n a travĂ©s de Hooks
        • MĂ³dulos, Reemplazo, Servicio Web
        • MĂ³dulos, Clases y Reemplazo del Controlador
        • Buenas prĂ¡cticas de Clase DB para Prestashop 1.4
        • MĂ³dulos de transportistas - funciones, creaciĂ³n y configuraciĂ³n
        • Curso Acelerado de Seguridad - Episodio 1 - Nunca ConfĂ­e en Datos Exteriores
        • Curso Acelerado de Seguridad - Episodio 2 - Inyecciones SQL
        • Curso Acelerado de Seguridad - Episodio 3 - XSS
        • Curso Acelerado de Seguridad - Episodio 4 - CSRF
      • Referencia del servicio web
    • GuĂ­a de Diseñador
      • CodificaciĂ³n de un tema
      • Consejos de Diseño
    • SoluciĂ³n de problemas
    • Preguntas Frecuentes
Powered by GitBook
On this page
  • Example
  • Structure

Was this helpful?

  1. English documentation 1.4
  2. Developer Guide
  3. Developer tutorials
  4. Using the REST webservice
  5. Chapter 3 - First steps - Access the Web service and list client

3.3 - List clients

We will now look at how to view a full list of clients' IDs. We could display more information and customize it…but we'll take a look at that later in this tutorial.

To retrieve an XML file containing all the customers we have to use the "get" method whose array is as follows:

Key

Value

resource

customers

$opt[ 'resource' ] = 'customers';
$xml = $webService->get( $opt ); 

The value defines the resource that the web service will use in a future call. The value could be carrier types, countries or any other type of resource that can be found in the Web Service tab of the "Back Office".

Example

Calling the method will return us to a SimpleXML object containing all client IDs.

<?xml>
<prestashop>
  <customers>
    <customer>
      Client ID
    </customer>
...Other client tags
  </customers>
</prestashop>

Now we need to access the tags that interest us in the XML file.

Structure

By getting the return of $webService->get, we are at the root of the document.

$resources = $xml->customers->children();

To access the fields of clients who are children from the Customers tag, we only need to retrieve all fields in an associative array in SimpleXML like this:

From there we can access client IDs easily. Here's an example with a path from identifiers:

foreach ( $resources as $resource )
  echo $resource->attributes() . '<br />'; 

Thanks to these elements, you create a HTML table containing all the customers' IDs before going on to the next chapter. You can use the "customers" tab in the Back Office to find the IDs of all customers. If you encounter difficulties, please look at the file code 0-CustomersList.php for the results you should get.

Previous3.2 - Handling errorsNextChapter 4 - Retrieve Data - Retrieving a Client

Last updated 4 years ago

Was this helpful?