Jump to content

Web Service Unavailable, error 503


lquenta

Recommended Posts

I had a fully functional prestashop store , was working with WEBSERVICE PRESTASHOP API to update the stock via cronjob, but since the past week i had a weird error, it looks that the way i query the products is not functional anymore:

HTTP REQUEST HEADER
GET /api/products?filter%5Breference%5D=01-R1002 HTTP/1.1
Host: selectavirtual.com
Accept: */*

HTTP RESPONSE HEADER
HTTP/1.1 503 Service Temporarily Unavailable
Server: nginx
Date: Tue, 20 Nov 2018 14:35:11 GMT
Content-Type: text/html
Content-Length: 206
Connection: keep-alive
RETURN HTTP BODY
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body bgcolor="white">
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>


Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 'This call to PrestaShop Web Services returned an unexpected HTTP status of:503' in /home/selectav/public_html/prestashop_bra/admin166ct2ohf/PSWebServiceLibrary.php:96 Stack trace: #0 /home/selectav/public_html/prestashop_bra/admin166ct2ohf/PSWebServiceLibrary.php(297): PrestaShopWebservice->checkStatusCode(503) #1 /home/selectav/public_html/prestashop_bra/admin166ct2ohf/prestashop_create_prod.php(151): PrestaShopWebservice->get(Array) #2 /home/selectav/public_html/prestashop_bra/admin166ct2ohf/prestashop_create_prod.php(16): check_producto_existe('01-R1002') #3 {main} thrown in /home/selectav/public_html/prestashop_bra/admin166ct2ohf/PSWebServiceLibrary.php on line 96

 

That's the dump i was receiving as a response, the method i'm using is the next.


 

function check_producto_existe($reference){
  echo 'checking...'.$reference;
  $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
  $opt['resource'] = 'products';
  $opt['filter']['reference'] = $reference;
  var_dump($webService);

   $xml = $webService->get($opt);
   $x = ($xml->products[0]->product->attributes());
 $ProductId = $x['id'];
 return $ProductId;

Please help, the code was working until the past week, but now it don't works.

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

hi guys

am getting the same problem 503 on all pages even with a fresh install on live server

i tried latest prestashop version 1.7.8.1 to no avail 

i can see the common thing between me "lquenta" is we are using the same server : NGINX

could it be an incompatibility issue with NGINX servers ??!!

Link to comment
Share on other sites

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...