??????????????API Broke!!!!!!!!!!

I have had my code working for months an all of a sudden today it does not work and returns the following message:
An error has occurred and we've been notified. Please try again and if this problem persists please contact support.
This is the line of code which worked for Months with no problems, it gets all of the special orders for a specific PO #:
If you make the call in postman it returns a count of 0.
The support folks are of no help...
Can any help????
here is the PHP code direct from Postman:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.lightspeedapp.com/API/Account/XXXXXX/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=925&status=Ordered',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer 9c80e5007feca01f6a9aca06bd4d0fac10381XXX'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Answers
I was able to perform a test GET query based on something like your second PHP example just now. Here's a Postman screen shot. Not sure if it's a transient error related to your account, an incorrect identifier, etc. Hmm...
This is mine!
So you have confirmed that specialOrderID 925 indeed exists in the particular site? Like drilling into it using the web client front-end? And it's not completed and it shows a status of being ordered? Quickest thing to do would be to leave off those query parameters for status and completed and see if the special order comes back. As a well as check for the ID manually in the site.
We are not using Shopify. I just have a script that runs labels for our special orders.
Pulled off all of the other params and it is still returning 0 in postman. And you can see the ID is correct at 925.
The fact that in the code when you do the call it returns "An error has occurred and we've been notified. Please try again and if this problem persists please contact support." Tells me something is wrong on the LS end
Sorry I meant to say Lightspeed Retail not Shopify. 😕
If it's consistently failing for just this one particular special order and the query parameters are removed then I would direct someone from Lightspeed to respond and look into it for you.
it fails with this call on any special order passed in as the ID. How do I get someone from Lightspeed to help. The app support is no help they did not do anything.
Just tried:
https://api.lightspeedapp.com/API/Account/{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLine.orderID=925
and it returns:
An error has occurred and we've been notified.
Please try again and if this problem persists please contact support.
Also...
Hi @rsirota. Leah here, from the API support team. I just want to let you know that we are aware of your issue and your posts and are looking into it. We will reply here when we have more information. Your patience is appreciated.
Thanks.
Lightspeed HQ
thank you!
I confirm the issue. Error 500 when requesting special order.
Example request:
get https://api.merchantos.com/API/Account/xxxxxx/SpecialOrder {'SaleLine.isSpecialOrder': 'true', 'status': '!=,Completed', 'offset': 0, 'limit': 100, 'load_relations': '["SaleLine","SaleLine.Item"]'}
Response:
An error has occurred and we've been notified.
Please try again and if this problem persists please contact support.
So is it being addressed?
So anything with the isSpecialOrder flag seems to cause the error
Days have passed but the problem has not been resolved. Are there any waiting times?
@niaztv it's been less than a full day since you're initial post. Based on other threads I don't see many trouble reports that are resolved very fast. Unless it's a really minor oversight such as case-sensitivity, an incorrect URL path, etc. And the example you posted of the GET request that fails looks weird. I don't see URL query parameters, it looks like a JSON request body.
Hi @niaztv,
Your query is trying to load all the SaleLines that are flagged as SpecialOrder while you’re already hitting the SpecialOrder endpoint. Since you’re already at the SpecialOrder endpoint, and only loading relations associated with those Special Orders, you do not need to specify SaleLine.isSpecialOrder, as this is redundant.
In order to solve your problem, you should remove ‘SaleLine.isSpecialOrder’: ‘true’ from your query.
@Ali_Masoumie what about the original poster's situation? The GET request didn't look malformed to me. 🤨
Can your group take the cf-request-id that appears in the response header and look to see what the incoming request looked like?
I just did a request again and got back the 0 count.
Here is the cf-request-id 0a9377c8de000024dfb03de000000001
In addition this code was working just fine until yesterday. This tells me that something on the server has changed.
@rsirota I can see the recent requests:
/API/Account/215XXX/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=913
and
/API/Account/215XXX/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=925
Are you certain there are special orders with those IDs that are not completed in this account? If not, it would be normal to get a 200 with 0 results
I see orders with those IDs, but those aren't the same IDs as special orders.
Order 925 is now completed, so if you tried to pull it up with
https://api.lightspeedapp.com/API/Account/XXXXXX/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=925&status=Ordered
You wouldn't get any results. You should, however, get a 200 response.
For the 500 error you mentioned above from the following request:
https://api.lightspeedapp.com/API/Account/
{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLine.orderID=925The problem here is the syntax of the relation. The relation at the SpecialOrder endpoint is OrderLines, not OrderLine.
The request should be:
https://api.lightspeedapp.com/API/Account/
{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLines.orderID=925Let me know if you have further questions or issues.
Lightspeed HQ
@Leah Let's work with Vendor with special order 913. There are a total of 6 special orders in Lightspeed for this PO. 3 are completed and 3 are listed as ordered.
When in Postman and I do the following command:
https://api.lightspeedapp.com/API/Account/{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=913
it returns 0. This would have worked in the past.
The following line:
https://api.lightspeedapp.com/API/Account/{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLines.orderID=913
Returns all special orders 176. which is not correct.
and
https://api.lightspeedapp.com/API/Account/{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLines.orderID=913&SaleLine.isSpecialOrder=true
returns the error:
<div>
An error has occurred and we've been notified.
Please try again and if this problem persists please contact support.
</div>
https://api.lightspeedapp.com/API/Account/{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=913&status=Ordered
also returns 0
Does that give you more information to go on?
I think you're still confused about the difference between and OrderID (the ID of the PO) and a SpecialOrderID (the ID of the special order)
Here's SpecialOrder 913 from your shop:
"SpecialOrder": {
"specialOrderID": "913",
"unitQuantity": "3",
"contacted": "true",
"completed": "true",
"timeStamp": "2020-09-12T21:20:45+00:00",
"status": "Completed",
"customerID": "4672",
"shopID": "1",
"saleLineID": "83491",
"orderLineID": "20544",
"transferItemID": "0",
"tax1Rate": "0.09125",
"tax2Rate": "0",
"isLayaway": "false",
"isWorkorder": "false",
"isSpecialOrder": "true",
"displayableSubtotal": "56.67",
"displayableUnitPrice": "20.99",
"calcLineDiscount": "6.3",
"calcTransactionDiscount": "0",
"calcTotal": "61.8411375",
"calcSubtotal": "62.97",
"calcTax1": "5.1711375",
"calcTax2": "0",
"taxClassID": "1",
"customerID": "4672",
"discountID": "7",
"employeeID": "7",
"itemID": "22129",
"noteID": "5708",
"parentSaleLineID": "0",
"shopID": "1",
"taxCategoryID": "1",
"saleID": "30579",
{{.......}}
"OrderLine": {
"orderLineID": "20544",
"quantity": "4",
"price": "15.67",
"originalPrice": "15.67",
"vendorCost": "0",
"checkedIn": "4",
"numReceived": "0",
"integrationQoh": "0",
"integrationOrdered": "0",
"integrationResponse": "",
"timeStamp": "2020-08-25T19:11:13+00:00",
"total": "62.68",
"taxAmount": "0",
"isTaxRateEdited": "false",
"orderID": "282",
"itemID": "22129"
}
}
There are two different IDs here. The Special Order ID (913), which is what you look up at the special order endpoint, and the OrderID which is the ID of the PO that originated the special order. In this case, the PO is 282.
This request:
https://api.lightspeedapp.com/API/Account/
{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&specialOrderID=913Is looking for SpecialOrderID 913, which is already completed, so returns 0 results.
Look at what happens if you simply request:
https://api.lightspeedapp.com/API/Account/
{{accountID}}/SpecialOrder/913.json?load_relations=allAs my colleague, Ali, mentioned above,
https://api.lightspeedapp.com/API/Account/
{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLines.orderID=913&SaleLine.isSpecialOrder=trueHas a redundancy in it that results in the 500 error,
SaleLine.isSpecialOrder=true
is a redundant parameter, since the request is already only looking at SaleLine entries for SpecialOrder objects.Now, this request:
https://api.lightspeedapp.com/API/Account/
{{accountID}}/SpecialOrder.json?load_relations=all&completed=false&OrderLines.orderID=913Is ostensibly looking for all Special Orders that originate from PO #913
but it seems that the parameter
OrderLines.orderID=913
is being ignored and all incomplete special orders are being returned. Is THIS what has changed for you, perhaps?Lightspeed HQ
@Leah Yes that is what changed.
This is the Purchase Order
and this is what the speical orders on that PO show
And this was the original line of code which I used in my php code that worked until yesterday:
$url = "https://api.lightspeedapp.com/API/Account/{$GLOBALS['accountID']}/SpecialOrder.json?load_relations=all&completed=false&status=Ordered&OrderLine.orderID={$selectedPO}";
where selected PO would be 913
@rsirota Ok, got it. I see the issue. The query parameter
OrderLine.orderID
seems to be no longer working. I will file a report with our dev team, but I suggest that in the meantime, you use the queryhttps://api.lightspeedapp.com/API/Account/{
$GLOBALS['accountID']}/SpecialOrder.json?load_relations=all&completed=falseThis will return all the open special orders and you will need to then drill down on your end to filter out the ones that contain the desired OrderID in the OrderLine relation to find the ones for your selected PO.
Lightspeed HQ
PLease advise when this gets fixed. Until then I will try the work around
Will do!
Lightspeed HQ