Page 1 of 1

Close quote via api

PostPosted: Thu Jun 11, 2026 9:24 am
by JuiceyBrucey
Hi,
7.2.1.0
SR 16
I am trying to close quotes via the API, but I am finding conflicting information on how to do this.
So far I have the following, but I am getting conflicting information on what the payload should be:
Code: Select all
$url = $this->NGROK_ENDPOINT_URL."SalesQuotes/".$QUOTE_ID."";
      curl_setopt($this->CURL_OBJ, CURLOPT_URL, $url);
      curl_setopt($this->CURL_OBJ, CURLOPT_COOKIEFILE, './cookies.txt'); // set cookie file to given file
      curl_setopt($this->CURL_OBJ, CURLOPT_COOKIEJAR, './cookies.txt'); // set same file as cookie jar
      curl_setopt($this->CURL_OBJ, CURLOPT_HTTPAUTH,     CURLAUTH_DIGEST); //poll the server to see what methods it supports and pick the best one
      curl_setopt($this->CURL_OBJ, CURLOPT_RETURNTRANSFER, $this->CURL_RETURNTRANSFER); // return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
      curl_setopt($this->CURL_OBJ, CURLOPT_CUSTOMREQUEST, "PATCH");
      
      $payload = '{
                  "QuoteID": "'.$QUOTE_ID.'",
                  "Status": "CANCELLED"
               }';
      curl_setopt($this->CURL_OBJ, CURLOPT_POSTFIELDS, $payload);
      
      curl_setopt($this->CURL_OBJ, CURLOPT_HTTPHEADER, [
         'Content-Type: application/json',
         'Content-Length: ' . strlen($payload)
      ]);

Re: Close quote via api

PostPosted: Thu Jun 11, 2026 12:14 pm
by Mike.Sheen
What conflicting information are you getting?

Please cite the sources so we can identify and rectify this.

You can determine the possible values of the Status by performing a GET on quotes of the different statuses and examining the json response.

In Jiwa, there are two possible statuses for a quote - Closed and not closed. You're sending:

Code: Select all
$payload = '{
                  "QuoteID": "'.$QUOTE_ID.'",
                  "Status": "CANCELLED"
               }';


Where did you get CANCELLED from?

A GET on a non-closed quote shows you this:
Code: Select all
{
...
    "QuoteID": "d3e28d9b366f4722af4f",
...
    "Status": "e_SalesQuoteEntered",
...


A GET on a closed quote shows you this:
Code: Select all
{
...
    "QuoteID": "d3e28d9b366f4722af4f",
...
    "Status": "e_SalesQuoteClosed",
...


So to close a quote, using your example, you would do:
Code: Select all
$payload = '{
                  "QuoteID": "'.$QUOTE_ID.'",
                  "Status": "e_SalesQuoteClosed"
               }';


But please do explain the source of the conflicting information you have found relating to this.