Jump to content

Prestashop API REST


Jotadrive

Recommended Posts

Hi fellas,

I am developing a mobile app in flutter which makes request to Prestashop API.

I noticed I can't make JSON POST requests (or I couldn't find it).

Should I build a custom API in Prestashop to do this kind of request ("Create order", "Create cart", etc...)?

 

Thanks

Link to comment
Share on other sites

Hi rrataj,

I am using a simple Prestashop store with Webservices enabled, so I can make GET request and all works fine.

First of all I am using Postman to do this request, but finally I would like to integrate it on flutter.

I would like to do requests as "Create order, Create cart, Create user" and other POST request via JSON (if it's possible, XML if not). I haven't done POST request before because I don't know which parameters should I include, format, etc...

I would appreciate your help if you have experience with this API.

 

Thanks a lot

Link to comment
Share on other sites

Hi all,

My fullfilment partner is using the WS API to retrieve the orders, updte stock and change order status.

They are also pushing the tracking code to my shop. However, the tracking has now started appearing with a strange suffix.
The fulfilment partner now claims Presta instance (gopure.shop) is adding this suffix and I'm sure this is coming from their end.

My question:

Is there a way/log to see the content of the WS requests they are sending.

I checked the logs presta saves to DB and nothing there.
Also found the server logs where I can find for example GET/PUT requests originating from their server like these:
xx.xx.xx.xx - - [06/Oct/2020:06:00:45 +0200] "PUT /api/stock_availables/242 HTTP/1.1" 200 660 "-" "-"
xx.xx.xx.xx - - [06/Oct/2020:06:00:46 +0200] "GET /api/stock_availables?filter%5Bid_product%5D=xx&filter%5Bid_product_attribute%5D=xxx&display=full HTTP/1.1" 200 699 "-" "-"

Is there a log or way to see what data their requests contain? Or do I need to use some kind of net traffic sniffer?

Link to comment
Share on other sites

I would try to override "classes/webservice/WebserviceRequest.php" Class and "fetch()" method and do something like:

public function fetch($key, $method, $url, $params, $bad_class_name, $inputXml = null)
    {
		// save to logs
		if( !empty( inputXml ) ) {
			PrestaShopLogger::addLog('Webservice input:' . $inputXml);
		}
		// call parent controller
		return parent::fetch($key, $method, $url, $params, $bad_class_name, $inputXml)
	}

But haven't tested it.

Link to comment
Share on other sites

  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...