How to integrate prestashop with Android?

I recently created an eshop website using prestashop

https://www.prestashop.com/en/

And since I'm going to create an Android app for him. Which includes only some basic functions in the application.

eg. create a customer account / view product / order product / pay / view order, etc. common eshop features ...

The problem is that there are few resources around. Is there any library already there / fictitious / do I need to start creating an API from a strike?

read http://doc.prestashop.com/display/PS16/Developer+Guide but don’t know what I need to get started.

This is a rather abstract problem, but since the community is not so popular and the resource is limited, I hope this can draw lessons from other experiences and help any other users with the same request.

Thank you for help

+7
android api php prestashop
source share
2 answers

The problem is that there are few resources around. Is there any library already there / dummy / or do I need to start creating an API from stratch?

Unlike one of the comments on your question, Prestashop really offers a REST service. The documentation mentions a "web service".

Quick links:

There are several versions of open source APIs , but not for Android / Java. However, you may find them useful as a guide.

A few notes:

By default, the web service feature is disabled. Therefore, to use it, you must first include it in the back office. Copied from documents:

Enabling the web service feature

Go to the PrestaShop back office, open the Web Service page under the Advanced Settings Menu, and then select Yes for the Enable PrestaShop webservice option. Save your changes: you're done!

An API key is required to communicate with the web service. You will need to create it for your Android application using the back office again:

Create Passkey

Open the Web Service page in the Advanced section. Settings ", and then click the" Add New "button to access the account configuration section. A long form will appear:

  • Key The API key is the primary identifier for the webservice account. Creature. Click "Create" to get a unique authentication key. You can also create your own (32 characters long), but using the generated key prevents the erroneous actions of your key too easily. Using this key, you and other selected users will be able to access the web service.
  • Description of the key . It helps you remember who you created this key, what access rights are assigned to it, etc. The description is not public, but do not forget to put all the keywords related to the user, so that you can quickly find their key.

  • Condition . You can disable any key at any time.

  • Access rights . This section is very important because it allows you to assign rights for each resource that you want to make available for this key. Indeed, you might want the user to have read and write access to some resources, but only read access to others - and not have access to more important ones. In the list of permissions, the checkbox most on the left allows you to define all the rights to this resource. Similarly, the checkbox at the top of each column gives you the right to choose (View, Edit, etc.) for all resources. Be sure to select the rights required to use this key. Do not give all rights to all resources for any key, save it only on your and yours. Shop Association. This appears only in multi-story mode. This allows you to choose which of your stores should have access to the key.

If you prefer to use a custom password rather than a generated one, make sure that it is very secure and that its rights are limited - and that it is 32 characters long!

Finally, to get an overview of the API methods:

Access web service from browser

The endpoint of your webservice store is located in the /api/ folder at the root of your Prestashop installation:

To access it, you must provide an API key when requested. There is no password, it is enough to provide your API key - and, therefore, the key must be kept secret by the user! You can either enter the API endpoint address directly, enter your API key or provide your API key in the address. Here is an example: UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX which is the API key.

You can test this with any browser that supports XML. If no permission has been set for the key, then the browser will continue to ask you to enter the key indefinitely.

The result should look something like this (for version 1.5.4.1 in PrestaShop):

 <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <api shop_name="MYSHOP"> <addresses>...</addresses> <carriers>...</carriers> <cart_rules>...</cart_rules> <carts>...</carts> <categories>...</categories> <combinations>...</combinations> <configurations>...</configurations> <contacts>...</contacts> <content_management_system>...</content_management_system> <countries>...</countries> <currencies>...</currencies> <customer_messages>...</customer_messages> <customer_threads>...</customer_threads> <customers>...</customers> <deliveries>...</deliveries> <employees>...</employees> <groups>...</groups> <guests>...</guests> <image_types>...</image_types> <images>...</images> <languages>...</languages> <manufacturers>...</manufacturers> <order_carriers>...</order_carriers> <order_details>...</order_details> <order_discounts>...</order_discounts> <order_histories>...</order_histories> <order_invoices>...</order_invoices> <order_payments>...</order_payments> <order_states>...</order_states> <orders>...</orders> <price_ranges>...</price_ranges> <product_feature_values>...</product_feature_values> <product_features>...</product_features> <product_option_values>...</product_option_values> <product_options>...</product_options> <product_suppliers>...</product_suppliers> <products>...</products> <search >...</search> <shop_groups>...</shop_groups> <shops>...</shops> <specific_price_rules>...</specific_price_rules> <specific_prices>...</specific_prices> <states>...</states> <stock_availables>...</stock_availables> <stock_movement_reasons>...</stock_movement_reasons> <stock_movements>...</stock_movements> <stocks>...</stocks> <stores>...</stores> <suppliers>...</suppliers> <supply_order_details>...</supply_order_details> <supply_order_histories>...</supply_order_histories> <supply_order_receipt_histories>...</supply_order_receipt_histories> <supply_order_states>...</supply_order_states> <supply_orders>...</supply_orders> <tags>...</tags> <tax_rule_groups>...</tax_rule_groups> <tax_rules>...</tax_rules> <taxes>...</taxes> <translated_configurations>...</translated_configurations> <warehouse_product_locations>...</warehouse_product_locations> <warehouses>...</warehouses> <weight_ranges>...</weight_ranges> <zones>...</zones> </api> <api shop_name="MYOTHERSHOP">...</api> <api shop_name="YETANOTHERSHOP">...</api> </prestashop> 

Since you mention that you are mostly interested in supporting the basic / core functions in the Android app, I am inclined to say that this probably suits your needs. :)

+7
source share

If you're not looking for a native app, you can try the revocable mobile template add-on or paid themes . If you need a native application and want to reuse the API from your prestashop store, you need to create access to Prestashop REST webservices

To check whether you have configured your access to the web service correctly, go to the page http: // mypasskey@mystore.com / api / , where "mypasskey" is replaced by your key.

+2
source share

All Articles