{"id":15145686,"url":"https://github.com/bukimedia/prestasharp","last_synced_at":"2025-04-09T04:04:20.749Z","repository":{"id":9287708,"uuid":"11121830","full_name":"Bukimedia/PrestaSharp","owner":"Bukimedia","description":"CSharp .Net client library for the PrestaShop API via web service","archived":false,"fork":false,"pushed_at":"2024-02-22T15:55:31.000Z","size":647,"stargazers_count":156,"open_issues_count":96,"forks_count":152,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-04-09T04:04:13.224Z","etag":null,"topics":["c-sharp","csharp","dot-net","dotnet","prestashop","prestashop-api","prestashop-webservice"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bukimedia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-02T09:48:04.000Z","updated_at":"2025-03-14T15:47:36.000Z","dependencies_parsed_at":"2024-02-06T14:42:01.376Z","dependency_job_id":"c11f55d9-8f56-40c9-8f60-df4c65782676","html_url":"https://github.com/Bukimedia/PrestaSharp","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bukimedia%2FPrestaSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bukimedia%2FPrestaSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bukimedia%2FPrestaSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bukimedia%2FPrestaSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bukimedia","download_url":"https://codeload.github.com/Bukimedia/PrestaSharp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974715,"owners_count":21026742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","csharp","dot-net","dotnet","prestashop","prestashop-api","prestashop-webservice"],"created_at":"2024-09-26T11:41:46.818Z","updated_at":"2025-04-09T04:04:20.726Z","avatar_url":"https://github.com/Bukimedia.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PrestaSharp\n\n[![Build Status](https://travis-ci.org/Bukimedia/PrestaSharp.svg?branch=master)](https://travis-ci.org/Bukimedia/PrestaSharp)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/Bukimedia/PrestaSharp.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/Bukimedia/PrestaSharp/alerts/)\n[![Language grade: C#](https://img.shields.io/lgtm/grade/csharp/g/Bukimedia/PrestaSharp.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/Bukimedia/PrestaSharp/context:csharp)\n\n### CSharp .Net client library for the PrestaShop API via web service\n\n## Introduction\nA simple .Net REST client written in C# for the Prestashop API.\nPrestaSharp uses the RestSharp library to consume the Prestashop services.\n\n# Installation\n\n[![NuGet](https://buildstats.info/nuget/PrestaSharp)](http://www.nuget.org/packages/PrestaSharp)\n\nPrestaSharp is [available on NuGet](https://www.nuget.org/packages/PrestaSharp/). Use the package manager\nconsole to install it:\n\n```powershell\nInstall-Package PrestaSharp\n```\n\n## Basic usage\n1) Initiate a client instance:\n\n```csharp\nstring baseUrl = \"http://www.myweb.com/api\";\nstring account = \"ASDLKJOIQWEPROQWUPRPOQPPRQOW\";\nstring password = \"\";\n\nManufacturerFactory manufacturerFactory = new ManufacturerFactory(baseUrl, account, password);\n```\n\n2) Perform CRUD actions through the client:\n\n```csharp\nBukimedia.PrestaSharp.Entities.manufacturer manufacturer = manufacturerFactory.Get(6);\nmanufacturer.name = \"Iron Maiden\";\nmanufacturer.active = 1;\nmanufacturerFactory.Add(manufacturer);\nmanufacturerFactory.Update(manufacturer);\nmanufacturerFactory.Delete(manufacturer);\n```\n\n3) Add an image:\n\n```csharp\nBukimedia.PrestaSharp.Entities.product myProduct = new Bukimedia.PrestaSharp.Entities.product();\nProductFactory productFactory = new ProductFactory(baseUrl, account, password);\nmyProduct = productFactory.Add(myProduct);\nImageFactory imageFactory = new ImageFactory(baseUrl, account, password);\nimageFactory.AddProductImage((long)myProduct.id, \"C:\\\\MyImage.jpg\");\n```\n\n4) Set quantity of products:\nThe quantity of a product may not be updated directly in the 'product' entity. You need to update 'stock_available' entity.\n\n```csharp\nStockAvailableFactory stockAvailableFactory = new StockAvailableFactory(baseUrl, account, password);\nlong stockAvailableId = myProduct.associations.stock_availables[0].id;\nBukimedia.PrestaSharp.Entities.stock_available myStockAvailable = stockAvailableFactory.Get(stockAvailableId);\nmyStockAvailable.quantity = 99; // Number of available products\nmyStockAvailable.out_of_stock = 1; // Must enable orders\nstockAvailableFactory.Update(myStockAvailable);\n```\n\n## Advanced usage\n1) Get all. This sample retrieves the list of manufacturers:\n\n```csharp\nList\u003cmanufacturer\u003e manufacturers = ManufacturerFactory.GetAll();\n```\n\n2) Get ids. This sample retrieves the list of the manufacturer ids:\n\n```csharp\nList\u003clong\u003e ids = ManufacturerFactory.GetIds();\n```\n\n3) Get by filter. This sample retrieves the list of manufacturers which name is \"Metallica\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"Metallica\");\nList\u003cmanufacturer\u003e manufacturers = ManufacturerFactory.GetByFilter(dtn, null, null);\n```\n\n4) Get by filter with wildcards. This sample retrieves the manufacturers which name starts with \"Metall\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"[Metall]%\");\nList\u003cmanufacturer\u003e manufacturers = ManufacturerFactory.GetByFilter(dtn, null, null);\n```\n\n5) Get ids by filter. This sample retrieves the list of the manufacturers ids which name is \"Metallica\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"Metallica\");\nList\u003clong\u003e ids = ManufacturerFactory.GetIdsByFilter(dtn, null, null);\n```\n\n6) Get ids by filter with wildcards. This sample retrieves the list of the manufacturers ids which name starts with \"Metall\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"[Metall]%\");\nList\u003clong\u003e ids = ManufacturerFactory.GetIdsByFilter(dtn, null, null);\n```\n\n7) Get by complex filter. This sample retrieves the top five manufacturers in ascendent sorting which name starts with \"Metall\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"[Metall]%\");\nList\u003cmanufacturer\u003e manufacturers = ManufacturerFactory.GetByFilter(dtn, \"name_ASC\", \"5\");\n```\n\n8) Get by filter for pagination. This sample retrieves the top five manufacturers from tenth position in ascendent sorting which name starts with \"Metall\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"[Metall]%\");\nList\u003cmanufacturer\u003e manufacturers = ManufacturerFactory.GetByFilter(dtn, \"name_ASC\", \"9,5\");\n```\n\n9) Get ids by filter. This sample retrieves the list of the manufacturers ids which name is \"Metallica\", \"Nirvana\" or \"Pantera\":\n\n```csharp\nDictionary\u003cstring, string\u003e dtn = new Dictionary\u003cstring, string\u003e();\ndtn.Add(\"name\", \"[Metallica|Nirvana|Pantera]\");\nList\u003clong\u003e ids = ManufacturerFactory.GetIdsByFilter(dtn, null, null);\n```\n\n10) Get by filter by range date. This sample retrieves the orders in a date range:\n\n```csharp\nDateTime startDate = new DateTime (2016, 1, 1);\nDateTime endDate = new DateTime (2016, 1, 31);\nDictionary\u003cstring, string\u003e filter = new Dictionary\u003cstring, string\u003e();\nstring dFrom = string.Format(\"{0:yyyy-MM-dd HH:mm:ss}\", startDate);\nstring dTo = string.Format(\"{0:yyyy-MM-dd HH:mm:ss}\", endDate);\nfilter.Add(\"date_add\", \"[\" + dFrom + \",\" + dTo + \"]\");\nList\u003clong\u003e prestaSharpOrderIds = this.OrderFactory.GetIdsByFilter(filter, \"id_DESC\", null);\n```\n\n## Supported resources\n- Address\n- Carriers\n- Carts\n- Categories\n- Combinations\n- Currencies\n- Customers\n- Customer Messages\n- Customer Threads\n- Guests\n- Groups\n- Images\n- Languages\n- Manufacturers\n- Messages\n- Orders\n- Order Carriers\n- Order Cart Rules\n- Order Histories\n- Order Invoices\n- Order States\n- Products\n- Product Features\n- Product Feature Values\n- Product Options\n- Product Option Values\n- Product Suppliers\n- Shops\n- Specific Prices\n- Specific Price Rules\n- States\n- Stock Availables\n- Tags\n- Tax\n- Tax Rule\n- Tax Rule Groups\n- Warehouse\n- Zones\n\n## Supported actions\n- Create\n- Read\n- Update\n- Delete\n\n## Roadmap\n- Add other resources\n\n## Debugging\n\nEnabling debugging in PrestaShop would make PrestaSharp exceptions more verbose, to enable that, edit ```/config/defines.inc.php``` file in your PrestaShop website and edit this code block:\n\n```php\ndefine('_PS_MODE_DEV_', false);\n```\n\nto:\n\n```php\ndefine('_PS_MODE_DEV_', true);\n```\n\nMore information in the development section of [PrestaShop's documentation](http://doc.prestashop.com/display/PS15/Setting+up+your+local+development+environment).\n\n\n## License\nPrestaSharp is GNU General Public License (GPL)\n\nThis program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantabilty or fitness for a particular purpose. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\nBukimedia reserves the right to mention of companies or individuals who use this software.\n\nCopyright (C) 2019 Bukimedia\n- Bukimedia: https://bukimedia.com/\n- Twitter: http://twitter.com/bukimedia\n- GitHub: https://github.com/bukimedia\n- PrestaSharp on Bukimedia: https://bukimedia.com/prestasharp/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbukimedia%2Fprestasharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbukimedia%2Fprestasharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbukimedia%2Fprestasharp/lists"}