<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Creating Invoice through REST API]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=8499</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8499&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Creating Invoice through REST API.]]></description>
		<lastBuildDate>Tue, 12 Nov 2019 17:30:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36422#p36422</link>
			<description><![CDATA[<p>If you manually include the necessary files, you will not need composer. Also the Slim3 version of index.php will need to have the array syntax reverted for use in PHP &lt; 5.4</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 12 Nov 2019 17:30:04 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36422#p36422</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36420#p36420</link>
			<description><![CDATA[<p>get it from here </p><p>https://getcomposer.org/download/</p><p>install into your server or to local(then copy all to server)&nbsp; then edit your composer.json to update dependency versions</p><p>then run composer install in command line</p>]]></description>
			<author><![CDATA[null@example.com (anoopmb)]]></author>
			<pubDate>Tue, 12 Nov 2019 14:41:36 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36420#p36420</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36419#p36419</link>
			<description><![CDATA[<p>It is composer based. How can I install composer for this API?</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Tue, 12 Nov 2019 14:33:54 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36419#p36419</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36418#p36418</link>
			<description><![CDATA[<p>Hello guys ,</p><p>I have updated api to Slim 3</p><p>We can easily implement Eloquent ORM too (Laravel One)</p><p>index.php looks like this</p><div class="codebox"><pre><code>if (!isset($path_to_root))
{
    $path_to_root = &quot;../../..&quot;;
}

ini_set(&#039;html_errors&#039;, false);
ini_set(&#039;xdebug.show_exception_trace&#039;, 0);
ini_set(&#039;xdebug.auto_trace&#039;, 2);
error_reporting(E_ALL);
ini_set(&quot;display_errors&quot;, 1);

include_once(&#039;config_api.php&#039;);

global $security_areas, $security_groups, $security_headings, $path_to_root, $db, $db_connections;

$page_security = &#039;SA_API&#039;;




include_once(FA_ROOT . &quot;/sales/includes/cart_class.inc&quot;);
include_once(FA_ROOT . &quot;/includes/session.inc&quot;);

include_once(FA_ROOT . &quot;/includes/ui.inc&quot;);
include_once(FA_ROOT . &quot;/sales/includes/sales_ui.inc&quot;);
include_once(FA_ROOT . &quot;/sales/includes/ui/sales_order_ui.inc&quot;);
include_once(FA_ROOT . &quot;/sales/includes/db/sales_order_db.inc&quot;);
include_once(FA_ROOT . &quot;/sales/includes/db/sales_invoice_db.inc&quot;);
include_once(FA_ROOT . &quot;/sales/includes/db/sales_delivery_db.inc&quot;);

include_once (API_ROOT . &quot;/vendor/autoload.php&quot;);

$app = new \Slim\App([
    &#039;debug&#039; =&gt; false,
    &#039;settings&#039; =&gt; [
        &#039;displayErrorDetails&#039; =&gt; true
    ]
]);

require __DIR__ . &quot;/app/Helpers/dependencies.php&quot;;
require __DIR__ . &quot;/app/Helpers/handlers.php&quot;;
require __DIR__ . &quot;/app/Helpers/middleware.php&quot;;


require __DIR__ . &#039;/app/Sales/routes.php&#039;;



$app-&gt;run();</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (anoopmb)]]></author>
			<pubDate>Tue, 12 Nov 2019 14:29:19 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36418#p36418</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36411#p36411</link>
			<description><![CDATA[<p>Done. Thanks.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 12 Nov 2019 06:02:15 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36411#p36411</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36406#p36406</link>
			<description><![CDATA[<p>No I have that code and it works fine for GET commands.</p><p>I didn&#039;t had any problem in reading the $content returned from the curl request, at all.</p><p>I had problem in sending the POST request using curl.</p><p>That is addressed by http_build_query($data); line.</p><p>In Wiki I suggest change the code as below for facurlrest.php</p><div class="codebox"><pre><code>Contents of facurlrest.php file:

&lt;?php
// FrontAccounting Bridge REST Test Script
// Author: Ap.Muthu
// Website: www.apmuthu.com
// Release Date: 2012-11-28

include_once &quot;fabridge.php&quot;;

$method = isset($_GET[&#039;m&#039;]) ? $_GET[&#039;m&#039;] : &#039;g&#039;; // g, p, t, d =&gt; GET, POST, PUT, DELETE
$action = isset($_GET[&#039;a&#039;]) ? $_GET[&#039;a&#039;] : &#039;&#039;;
$record = isset($_GET[&#039;r&#039;]) ? $_GET[&#039;r&#039;] : &#039;&#039;;
$filter = isset($_GET[&#039;f&#039;]) ? $_GET[&#039;f&#039;] : false;

// Sample Data for POST
$data = array(
&#039;firstName&#039;=&gt; &#039;John&#039;,
&#039;lastName&#039;=&gt; &#039;Doe&#039;
);

$data = http_build_query($data);

$output = fa_bridge($method, $action, $record, $filter, $data);
echo print_r($output, true);

?&gt;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Tue, 12 Nov 2019 02:11:09 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36406#p36406</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36403#p36403</link>
			<description><![CDATA[<p>You probably missed the json_decode line in fabridge.php file at near the end:<br /></p><div class="codebox"><pre><code>$content = ($code == &quot;200&quot;) ? json_decode($content, true) : false;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 11 Nov 2019 17:00:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36403#p36403</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36402#p36402</link>
			<description><![CDATA[<p>@apmuthu, I was right. The problem was not of PHP.</p><p>This Post helped me. <a href="https://stackoverflow.com/questions/13596799/how-do-i-use-arrays-in-curl-post-requests">STACK OVERFLOW</a></p><p>now facurlrest.php looks like below</p><div class="codebox"><pre><code>&lt;?php
// FrontAccounting Bridge REST Test Script
// Author: Ap.Muthu
// Website: www.apmuthu.com
// Release Date: 2012-11-28

include_once &quot;fabridge.php&quot;;

$method = isset($_GET[&#039;m&#039;]) ? $_GET[&#039;m&#039;] : &#039;g&#039;; // g, p, t, d =&gt; GET, POST, PUT, DELETE
$action = isset($_GET[&#039;a&#039;]) ? $_GET[&#039;a&#039;] : &#039;&#039;;
$record = isset($_GET[&#039;r&#039;]) ? $_GET[&#039;r&#039;] : &#039;&#039;;
$filter = isset($_GET[&#039;f&#039;]) ? $_GET[&#039;f&#039;] : false;

$data =  array(
      &#039;trans_type&#039; =&gt; &#039;10&#039;,
      &#039;ref&#039;=&gt; &#039;NoGuia0001&#039;,
      &#039;customer_id&#039;=&gt; &#039;78&#039;,
      &#039;branch_id&#039;=&gt; &#039;78&#039;,
      &#039;location&#039;=&gt; &#039;DEF&#039;,
      &#039;deliver_to&#039;=&gt; &#039;ABC, S.A. DE C.V.&#039;,
      &#039;delivery_date&#039;=&gt; &#039;09/11/2019&#039;,
      &#039;delivery_address&#039;=&gt; &#039;Karachi&#039;,
      &#039;order_date&#039;=&gt; &#039;09/11/2019&#039;,
      &#039;phone&#039;=&gt; &#039;&#039;,
      &#039;cust_ref&#039;=&gt; &#039;&#039;,
      &#039;comments&#039;=&gt; &#039;&#039;,
      &#039;ship_via&#039;=&gt; &#039;1&#039;,
      &#039;payment&#039;=&gt; &#039;1&#039;,
      &#039;sales_type&#039;=&gt; &#039;1&#039;,
      &#039;items&#039;=&gt; array
        (
          0 =&gt; array
          (
            &#039;stock_id&#039;=&gt; &#039;2801&#039;,
            &#039;description&#039;=&gt; &#039;iPhone&#039;,
            &#039;qty&#039;=&gt; &#039;1&#039;,
            &#039;price&#039;=&gt; &#039;100&#039;,
            &#039;discount&#039;=&gt; &#039;0&#039;
          ),
          1 =&gt; array
          (
            &#039;stock_id&#039;=&gt; &#039;2802&#039;,
            &#039;description&#039;=&gt; &#039;Samsung&#039;,
            &#039;qty&#039;=&gt; &#039;1&#039;,
            &#039;price&#039;=&gt; &#039;100&#039;,
            &#039;discount&#039;=&gt; &#039;0&#039;
          ),
        ),

      );

$data = http_build_query($data);

$output = fa_bridge($method, $action, $record, $filter, $data);

?&gt;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 11 Nov 2019 16:40:03 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36402#p36402</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36401#p36401</link>
			<description><![CDATA[<p>Ok, one more thing.</p><p>The current core api module doesn&#039;t have the line of code to decode as below. </p><p>json_decode($info, true);</p><p>So is it assumed that the POST data being sent through api is already decoded by the time it reaches at this point</p><div class="codebox"><pre><code>function sales_add()
{
    $app    = \Slim\Slim::getInstance(&#039;SASYS&#039;);
    $req    = $app-&gt;request();
    $info    = $req-&gt;post();</code></pre></div><p>Or something is missed here?</p><p>Because without converting the JSON data into PHP Array we can&#039;t add it to cart.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 11 Nov 2019 13:57:02 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36401#p36401</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36400#p36400</link>
			<description><![CDATA[<p>My test was on browser only. Check your PHP.ini settings in CLI and in webserver for any differences.</p><p>The CLI output for <strong>php check.php</strong> is:<br /></p><div class="codebox"><pre><code>&quot;{\&quot;trans_type\&quot;:\&quot;10\&quot;,\&quot;ref\&quot;:\&quot;NoGuia0001\&quot;,\&quot;customer_id\&quot;:\&quot;78\&quot;,\&quot;branch_id\&quot;:\&quot;78\&quot;,\&quot;location\&quot;:\&quot;DEF\&quot;,\&quot;deliver_to\&quot;:\&quot;ABC, S.A. DE C.V.\&quot;,\&quot;delivery_date\&quot;:\&quot;2019\\\/11\\\/09\&quot;,\&quot;delivery_address\&quot;:\&quot;Karachi\&quot;,\&quot;order_date\&quot;:\&quot;09\\\/11\\\/2019\&quot;,\&quot;phone\&quot;:\&quot;\&quot;,\&quot;cust_ref\&quot;:\&quot;\&quot;,\&quot;comments\&quot;:\&quot;\&quot;,\&quot;ship_via\&quot;:\&quot;1\&quot;,\&quot;payment\&quot;:\&quot;1\&quot;,\&quot;sales_type\&quot;:\&quot;1\&quot;,\&quot;items\&quot;:[{\&quot;stock_id\&quot;:\&quot;2801\&quot;,\&quot;description\&quot;:\&quot;iPhone\&quot;,\&quot;qty\&quot;:\&quot;1\&quot;,\&quot;price\&quot;:\&quot;100\&quot;,\&quot;discount\&quot;:\&quot;0\&quot;},{\&quot;stock_id\&quot;:\&quot;2802\&quot;,\&quot;description\&quot;:\&quot;Samsung\&quot;,\&quot;qty\&quot;:\&quot;1\&quot;,\&quot;price\&quot;:\&quot;100\&quot;,\&quot;discount\&quot;:\&quot;0\&quot;}]}&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 11 Nov 2019 13:38:03 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36400#p36400</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36398#p36398</link>
			<description><![CDATA[<p>I am using PHP Version 5.6.40 on CentOs Linux Cloud.</p><p>But I think this is not related to PHP version. Have you given the above output after sending the $data through curl request in API?</p><p>In my first post I have shown two outputs of same data.</p><p>First one is read at the receiving server of API call. (Not JSON optimized)</p><p>Second one is at the Send Server before API call. (JSON optimized)</p><p>So If the PHP version is causing the issue then both outputs shall be same.</p><p>In my case sending and receiving servers are same server with two different directories.</p><p>Can you please retest it with the API Call?</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 11 Nov 2019 13:32:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36398#p36398</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36396#p36396</link>
			<description><![CDATA[<p>This is possibly a PHP version problem - which version are you using?</p><p>In PHP v5.3.1 on XAMPP 1.7.3 on WInXP SP3, the following was output for: <strong>echo json_encode($data, true);</strong>:<br /></p><div class="codebox"><pre><code>&quot;{\&quot;trans_type\&quot;:\&quot;10\&quot;,\&quot;ref\&quot;:\&quot;NoGuia0001\&quot;,\&quot;customer_id\&quot;:\&quot;78\&quot;,\&quot;branch_id\&quot;:\&quot;78\&quot;,\&quot;location\&quot;:\&quot;DEF\&quot;,\&quot;deliver_to\&quot;:\&quot;ABC, S.A. DE C.V.\&quot;,\&quot;delivery_date\&quot;:\&quot;2019\\\/11\\\/09\&quot;,\&quot;delivery_address\&quot;:\&quot;Karachi\&quot;,\&quot;order_date\&quot;:\&quot;09\\\/11\\\/2019\&quot;,\&quot;phone\&quot;:\&quot;\&quot;,\&quot;cust_ref\&quot;:\&quot;\&quot;,\&quot;comments\&quot;:\&quot;\&quot;,\&quot;ship_via\&quot;:\&quot;1\&quot;,\&quot;payment\&quot;:\&quot;1\&quot;,\&quot;sales_type\&quot;:\&quot;1\&quot;,\&quot;items\&quot;:[{\&quot;stock_id\&quot;:\&quot;2801\&quot;,\&quot;description\&quot;:\&quot;iPhone\&quot;,\&quot;qty\&quot;:\&quot;1\&quot;,\&quot;price\&quot;:\&quot;100\&quot;,\&quot;discount\&quot;:\&quot;0\&quot;},{\&quot;stock_id\&quot;:\&quot;2802\&quot;,\&quot;description\&quot;:\&quot;Samsung\&quot;,\&quot;qty\&quot;:\&quot;1\&quot;,\&quot;price\&quot;:\&quot;100\&quot;,\&quot;discount\&quot;:\&quot;0\&quot;}]}&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 11 Nov 2019 13:11:23 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36396#p36396</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36394#p36394</link>
			<description><![CDATA[<p>Ok Thanks for pointing this out. But problem doesn&#039;t lie here.</p><p>Even If I pass following simplest data as given in wiki</p><div class="codebox"><pre><code>$data = json_encode(array(
&#039;firstName&#039;=&gt; &#039;John&#039;,
&#039;lastName&#039;=&gt; &#039;Doe&#039;
));

$output = fa_bridge($method, $action, $record, $filter, $data);</code></pre></div><p>It is parsed in api/sales.inc as below</p><div class="codebox"><pre><code>function sales_add()
{
    $app    = \Slim\Slim::getInstance(&#039;SASYS&#039;);
    $req    = $app-&gt;request();
    $info    = $req-&gt;post();

The variable $info is read as below

Array
(
    [{&quot;firstName&quot;:&quot;John&quot;,&quot;lastName&quot;:&quot;Doe&quot;}] =&gt; 
)</code></pre></div><p>While it shall be parsed as below<br /></p><div class="codebox"><pre><code>{&quot;firstName&quot;:&quot;John&quot;,&quot;lastName&quot;:&quot;Doe&quot;}</code></pre></div><p>Please Check this <a href="https://prnt.sc/pvdi0b">https://prnt.sc/pvdi0b</a></p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 11 Nov 2019 12:37:05 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36394#p36394</guid>
		</item>
		<item>
			<title><![CDATA[Re: Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36390#p36390</link>
			<description><![CDATA[<p>You have used the same subscript for both items. Try the following:<br /></p><div class="codebox"><pre><code>$data =  json_encode(array(
      &#039;trans_type&#039; =&gt; &#039;10&#039;,
      &#039;ref&#039;=&gt; &#039;NoGuia0001&#039;,
      &#039;customer_id&#039;=&gt; &#039;78&#039;,
      &#039;branch_id&#039;=&gt; &#039;78&#039;,
      &#039;location&#039;=&gt; &#039;DEF&#039;,
      &#039;deliver_to&#039;=&gt; &#039;ABC, S.A. DE C.V.&#039;,
      &#039;delivery_date&#039;=&gt; &#039;2019/11/09&#039;,
      &#039;delivery_address&#039;=&gt; &#039;Karachi&#039;,
      &#039;order_date&#039;=&gt; &#039;09/11/2019&#039;,
      &#039;phone&#039;=&gt; &#039;&#039;,
      &#039;cust_ref&#039;=&gt; &#039;&#039;,
      &#039;comments&#039;=&gt; &#039;&#039;,
      &#039;ship_via&#039;=&gt; &#039;1&#039;,
      &#039;payment&#039;=&gt; &#039;1&#039;,
      &#039;sales_type&#039;=&gt; &#039;1&#039;,
      &#039;items&#039;=&gt; array
        (
          array
          (
            &#039;stock_id&#039;=&gt; &#039;2801&#039;,
            &#039;description&#039;=&gt; &#039;iPhone&#039;,
            &#039;qty&#039;=&gt; &#039;1&#039;,
            &#039;price&#039;=&gt; &#039;100&#039;,
            &#039;discount&#039;=&gt; &#039;0&#039;
          ),
          array
          (
            &#039;stock_id&#039;=&gt; &#039;2802&#039;,
            &#039;description&#039;=&gt; &#039;Samsung&#039;,
            &#039;qty&#039;=&gt; &#039;1&#039;,
            &#039;price&#039;=&gt; &#039;100&#039;,
            &#039;discount&#039;=&gt; &#039;0&#039;
          ),
        ),

      ));</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 11 Nov 2019 10:11:27 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36390#p36390</guid>
		</item>
		<item>
			<title><![CDATA[Creating Invoice through REST API]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=36387#p36387</link>
			<description><![CDATA[<p>Using the Latest API module (modified by @ApMuthu) and guidance given in Wiki I modified the following file</p><p><strong>facurlrest.php</strong><br /></p><div class="codebox"><pre><code>&lt;?php
// FrontAccounting Bridge REST Test Script
// Author: Ap.Muthu
// Website: www.apmuthu.com
// Release Date: 2012-11-28

include_once &quot;fabridge.php&quot;;

$method = isset($_GET[&#039;m&#039;]) ? $_GET[&#039;m&#039;] : &#039;g&#039;; // g, p, t, d =&gt; GET, POST, PUT, DELETE
$action = isset($_GET[&#039;a&#039;]) ? $_GET[&#039;a&#039;] : &#039;&#039;;
$record = isset($_GET[&#039;r&#039;]) ? $_GET[&#039;r&#039;] : &#039;&#039;;
$filter = isset($_GET[&#039;f&#039;]) ? $_GET[&#039;f&#039;] : false;

$data =  json_encode(array(
      &#039;trans_type&#039; =&gt; &#039;10&#039;,
      &#039;ref&#039;=&gt; &#039;NoGuia0001&#039;,
      &#039;customer_id&#039;=&gt; &#039;78&#039;,
      &#039;branch_id&#039;=&gt; &#039;78&#039;,
      &#039;location&#039;=&gt; &#039;DEF&#039;,
      &#039;deliver_to&#039;=&gt; &#039;ABC, S.A. DE C.V.&#039;,
      &#039;delivery_date&#039;=&gt; &#039;2019/11/09&#039;,
      &#039;delivery_address&#039;=&gt; &#039;Karachi&#039;,
      &#039;order_date&#039;=&gt; &#039;09/11/2019&#039;,
      &#039;phone&#039;=&gt; &#039;&#039;,
      &#039;cust_ref&#039;=&gt; &#039;&#039;,
      &#039;comments&#039;=&gt; &#039;&#039;,
      &#039;ship_via&#039;=&gt; &#039;1&#039;,
      &#039;payment&#039;=&gt; &#039;1&#039;,
      &#039;sales_type&#039;=&gt; &#039;1&#039;,
      &#039;items&#039;=&gt; array
        (
          0 =&gt; array
          (
            &#039;stock_id&#039;=&gt; &#039;2801&#039;,
            &#039;description&#039;=&gt; &#039;iPhone&#039;,
            &#039;qty&#039;=&gt; &#039;1&#039;,
            &#039;price&#039;=&gt; &#039;100&#039;,
            &#039;discount&#039;=&gt; &#039;0&#039;
          ),
          0 =&gt; array
          (
            &#039;stock_id&#039;=&gt; &#039;2802&#039;,
            &#039;description&#039;=&gt; &#039;Samsung&#039;,
            &#039;qty&#039;=&gt; &#039;1&#039;,
            &#039;price&#039;=&gt; &#039;100&#039;,
            &#039;discount&#039;=&gt; &#039;0&#039;
          ),
        ),

      ));


$output = fa_bridge($method, $action, $record, $filter, $data);

?&gt;</code></pre></div><p>The $data is being read at <strong>modules/api/sales.inc</strong> at Line: 256 as below</p><div class="codebox"><pre><code>Array
(
    [{&quot;trans_type&quot;:&quot;10&quot;,&quot;ref&quot;:&quot;NoGuia0001&quot;,&quot;customer_id&quot;:&quot;78&quot;,&quot;branch_id&quot;:&quot;78&quot;,&quot;location&quot;:&quot;DEF&quot;,&quot;deliver_to&quot;:&quot;ABC,_S_A__DE_C_V_&quot;,&quot;delivery_date&quot;:&quot;2019\/11\/09&quot;,&quot;delivery_address&quot;:&quot;Karachi&quot;,&quot;order_date&quot;:&quot;09\/11\/2019&quot;,&quot;phone&quot;:&quot;&quot;,&quot;cust_ref&quot;:&quot;&quot;,&quot;comments&quot;:&quot;&quot;,&quot;ship_via&quot;:&quot;1&quot;,&quot;payment&quot;:&quot;1&quot;,&quot;sales_type&quot;:&quot;1&quot;,&quot;items&quot;:] =&gt; Array
        (
            [{&quot;stock_id&quot;:&quot;2802&quot;,&quot;description&quot;:&quot;Samsung&quot;,&quot;qty&quot;:&quot;1&quot;,&quot;price&quot;:&quot;100&quot;,&quot;discount&quot;:&quot;0&quot;}] =&gt; 
        )

)</code></pre></div><p>While the Correct JSON Presentation of this Data shall be</p><div class="codebox"><pre><code>{&quot;trans_type&quot;:&quot;10&quot;,&quot;ref&quot;:&quot;NoGuia0001&quot;,&quot;customer_id&quot;:&quot;78&quot;,&quot;branch_id&quot;:&quot;78&quot;,&quot;location&quot;:&quot;DEF&quot;,&quot;deliver_to&quot;:&quot;ABC, S.A. DE C.V.&quot;,&quot;delivery_date&quot;:&quot;2019\/11\/09&quot;,&quot;delivery_address&quot;:&quot;Karachi&quot;,&quot;order_date&quot;:&quot;09\/11\/2019&quot;,&quot;phone&quot;:&quot;&quot;,&quot;cust_ref&quot;:&quot;&quot;,&quot;comments&quot;:&quot;&quot;,&quot;ship_via&quot;:&quot;1&quot;,&quot;payment&quot;:&quot;1&quot;,&quot;sales_type&quot;:&quot;1&quot;,
&quot;items&quot;:[{&quot;stock_id&quot;:&quot;2802&quot;,&quot;description&quot;:&quot;Samsung&quot;,&quot;qty&quot;:&quot;1&quot;,&quot;price&quot;:&quot;100&quot;,&quot;discount&quot;:&quot;0&quot;}]}</code></pre></div><p>How to handle this?</p><p>Due to wrong presentation of JSON Data I am not able to apply json_decode($data, true).</p><p>However, I have tested the api successfully by manually putting the correct presentation of this data on <strong>modules/api/sales.inc</strong></p><p>Regards.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 11 Nov 2019 08:14:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=36387#p36387</guid>
		</item>
	</channel>
</rss>
