Close quote via api

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Close quote via api

Postby JuiceyBrucey » Thu Jun 11, 2026 9:24 am

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)
      ]);
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 189
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: Close quote via api

Postby Mike.Sheen » Thu Jun 11, 2026 12:14 pm

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.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2592
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 817


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 41 guests