Fetch the GSTR-1 report using XML request and receive the response in JSON format

Discussion in 'Tally Developer' started by Researcher1, May 7, 2024.

    
  1. Researcher1

    Researcher1 Member


    I am able to fetch the GSTR-1 report from Tally Prime by navigating to:
    Gateway of Tally --> Statutory Reports --> GST Reports --> GSTR-1, then clicking on 'Export', selecting 'gstr returns', and choosing the JSON format.

    I am attempting to achieve the same result using the following XML request in Tally Prime:
    Code:
    <ENVELOPE>
      <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Data</TYPE>
        <ID>Day Book</ID>
      </HEADER>
      <BODY>
        <DESC>
          <STATICVARIABLES>
            <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          </STATICVARIABLES>
          <TDL>
            <TDLMESSAGE>
              <REPORT NAME="Day Book" ISMODIFY="Yes">
                <ADD>Set : ISLEDGERWISE : Yes</ADD>
                <ADD>Set : SVCURRENTCOMPANY : "Company Name"</ADD>
                <ADD>Set : SVFROMDATE : $$Date:"01-Apr-2024"</ADD>
                <ADD>Set : SVTODATE : $$Date:"30-Apr-2024"</ADD>
                <ADD>Set : VchTypeNameNew : $$SysName:AllItems</ADD>
                <ADD>Set : pGSTReportName : ""</ADD>
                <ADD>Set : ExplodeFlag : Yes</ADD>
              </REPORT>
            </TDLMESSAGE>
          </TDL>
        </DESC>
      </BODY>
    </ENVELOPE>
    
    However, this XML request returns the data in XML format.
    I would like the response to be in JSON format.
    Is there a way to modify the request to achieve this, or is there another XML request that will return the GSTR-1 report in JSON format?
     


  2. Sai Vineeth

    Sai Vineeth Active Member


    As of now JSON format not available in this approach
     


  3. Researcher1

    Researcher1 Member


    I am using the query below, which provides a response in XML format.
    However, it includes only a few tags that match the JSON response that I manually obtained from the Tally interface.

    Code:
    <ENVELOPE>
      <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
      </HEADER>
      <BODY>
        <EXPORTDATA>
          <REQUESTDESC>
            <STATICVARIABLES>
              <EXPLODEFLAG>Yes</EXPLODEFLAG>
              <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
              <SVFROMDATE>20240401</SVFROMDATE>
              <SVTODATE>20240430</SVTODATE>
            </STATICVARIABLES>
            <REPORTNAME>GSTR1JsonExport</REPORTNAME>
          </REQUESTDESC>
        </EXPORTDATA>
      </BODY>
    </ENVELOPE>
    
    I am unable to obtain all the tags that appear in the JSON response of the Tally user interface in my XML response.

    Here is my response for the above request.

    Code:
    <GSTIN></GSTIN>
    <FP>042024</FP>
    <GT>0.00</GT>
    <CUR_GT>0.00</CUR_GT>
    <HSN>
      <DATA>
        <NUM>1</NUM>
        <HSN_SC></HSN_SC>
        <DESC></DESC>
        <UQC>OT</UQC>
        <QTY>0</QTY>
        <RT>14</RT>
        <TXVAL>1100.00</TXVAL>
        <IAMT>0.00</IAMT>
        <CAMT>0.00</CAMT>
        <SAMT>99.00</SAMT>
        <CSAMT>0.00</CSAMT>
      </DATA>
      <DATA>
        <NUM>2</NUM>
        <HSN_SC></HSN_SC>
        <DESC></DESC>
        <UQC>OT</UQC>
        <QTY>0</QTY>
        <RT>12</RT>
        <TXVAL>100.00</TXVAL>
        <IAMT>0.00</IAMT>
        <CAMT>0.00</CAMT>
        <SAMT>6.00</SAMT>
        <CSAMT>0.00</CSAMT>
      </DATA>
      <DATA>
        <NUM>3</NUM>
        <HSN_SC></HSN_SC>
        <DESC></DESC>
        <UQC>NA</UQC>
        <QTY>0</QTY>
        <RT>12</RT>
        <TXVAL>2000.00</TXVAL>
        <IAMT>0.00</IAMT>
        <CAMT>0.00</CAMT>
        <SAMT>10.00</SAMT>
        <CSAMT>0.00</CSAMT>
      </DATA>
    </HSN>
    
    Could you please modify the query so that I can get all the required tags using the XML request?

    Alternatively, could you suggest a method by which I can receive the response of this XML request in JSON format?
     
    Last edited: May 9, 2024


Share This Page