I’m trying to delete a quote from a PHP API connecting to Epicor’s REST API, using this standard HTTP DELETE method I found in the Swagger Api help UI:
“[…]api/v1/Erp.BO.QuoteSvc/Quotes/($companyName,$quoteNum)”
I can run this directly from the Swagger web GUI, and I get a 204 response, and can confirm the quote did in fact go away.
I can also quickly set up Postman to send a DELETE request to the same url, and it worked on the first try. Quote $quoteNum is gone. 204 response.
Then to my actual app…
$delQuoteUrl = "[...]/api/v1/Erp.BO.QuoteSvc/Quotes/($companyName,$quoteN)";
$curl = curl_init();
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curl, CURLOPT_URL, $delQuoteURL );
curl_setopt( $curl, CURLOPT_USERPWD, $uname . ":" . $pword );
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, "DELETE");
$response = curl_exec( $curl );
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close( $curl );
Nope. It does not delete the quote.
It does not return any helpful information on why it didn’t delete the quote.
curl_error($curl) is false.
http response code is 0.
I tried using the same headers I used for the create quote command, both individually and all included:
curl_setopt( $curl, CURLOPT_HTTPHEADER,array('Content-Type:application/json;charset=utf-8','Accept:application/json','CallSettings:{"Company":"$companyName"}' ));
Which shouldn’t have been necessary, as Postman worked without setting those headers.
Also tried replacing the ‘CUSTOMREQUEST’ line with
curl_setopt( $curl, CURLOPT_DELETE, true);
And tried setting CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER to false. Then tried setting them to true.
Anyway, none of it made any difference. No effect, no error message, no response code, nothing.
Now what? Am I missing anything obvious?