The GraphAPI module for PrestaShop is a powerful tool that enables dynamic GraphQL-based access to your PrestaShop store's resources. This module allows clients to query and retrieve only the data they need, optimizing performance and providing a flexible API for your e-commerce platform.
- GraphQL Integration: Implement GraphQL to provide efficient and flexible access to PrestaShop resources.
- Dynamic Queries: Clients can craft queries to request specific data, reducing overhead.
- Exception Handling: Robust error handling to ensure smooth operation even in case of query errors.
- Performance Metrics: Monitor and optimize performance with built-in timing measurements.
Before using this module, ensure you have the following prerequisites installed:
- PrestaShop (min version 1.7)
- Composer
- ChromeiQL - Chrome extension for the GraphiQL tool (not included with PrestaShop, this is optional: maybe you use another client to interrogate the GraphQL API and it is also perfectly valid.)
-
Clone this repository to your PrestaShop modules directory:
git clone https://github.com/cbatista8a/graphapi.git modules/graphapi cd modules/graphapi composer install -
After
composer installyou need to do some tricks for avoid errors caused for namespace collisions between this module and Prestashop dependencies.composer prefix-namespace composer clean composer build composer install --no-dev
-
Navigate to your PrestaShop admin panel and go to Modules and Services.
-
Find the "GraphAPI" module and click "Install."
- Configure your ChromeiQL client and set your endpoint e.g., http://yourstore.com/graph-api
- Make requests to the module's endpoint, , with your GraphQL query as the request body.
- Example GraphQL query:
{
categories {
id
localizedFields(id_lang:1) {
name
}
parent {
id
localizedFields(id_lang:1) {
name
}
}
}
}You can monitor the performance of your GraphAPI requests by inspecting the response's performance object (when Debug mode or profiling are enabled), which includes timing information.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Thank you for considering contributing to this project! To get started, follow these steps:
- Fork the repository on GitHub.
- Create a branch for your feature or bug fix.
- Make your changes and commit them with clear commit messages.
- Push your changes to your fork.
- Create a pull request to the
masterbranch of this repository.
If you have any questions or need further assistance, feel free to reach out to the project maintainer:
Author: Carlos Batista | CubaDevOps Founder
Email: carlos.batista@cubadevops.com
PrestaShop - The e-commerce platform used as the foundation for this module.
Hacktoberfest - for celebrating open source contributions every October and inspiring me to open this private repository to the community.
We appreciate your interest in contributing to open source and hope you find this module useful!