Get Data
Send XML requests for the correct data and use the responses as required. To request any data, identify the type of request. Based on the type, the ID tag in XML request contains the identifier of the appropriate TDL definition name.
- If the request is for a Report, the type of request is Data. If the type is Data, the ID tag contains TDL report name.
- If the request is for a Collection, the type of request is Collection. If the type is Collection, the ID tag is TDL collection name.
Fetching a Report
To retrieve the details of the report Trial Balance, the <TYPE> is Data, and the <ID> is Trial Balance, as given below:
HTTP Headers
ID: TrialBalance
SOURCE: <Partner Source Name>
TARGET: TALLY
CONTENT-TYPE:text/xml;charset=utf-16
TARGETACCOUNTINTERNALID: <ACCOUNTINTERNALID>
TARGETCOMPANYNAME: <COMPANYCONNECTNAME>
XML Message
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>TrialBalance</ID>
<SessionID>{Replace with Session ID}</SessionID>
<Token>{Replace with Token Incremental Number per request}</Token>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVCurrentCompany>
{Company name in Tally i.e.,the value received in <SERVERCOMPANYNAME>}
</SVCurrentCompany>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
In the XML request, the <EXPLODEFLAG> indicates that the Trial Balance to be exploded with details.
Note: Export relevant Tally reports, for example, Trial Balance, in XML format to view the XML response. To fetch another report, ID in header, and request XML need to be changed to the required report name.
Fetching Data Using XML TDL
The tag <ID> contains the customized TDL Reports, Collection, and so on. This happens if the TDL is associated with TallyPrime, or when the XML TDL is available at the partner’s server. The XML TDL is designed to be added with this request. Also, the partner’s server sending the request with TDL, is to be whitelisted.
The XML request including TDL within XML is:
HTTP Headers
ID: Collection of Ledgers
SOURCE: <Partner Source Name>
TARGET: TALLY
CONTENT-TYPE:text/xml;charset=utf-16
TARGETACCOUNTINTERNALID: <ACCOUNTINTERNALID>
TARGETCOMPANYNAME: <COMPANYCONNECTNAME>
XML Message
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>Collection of Ledgers</ID>
<SessionID>{Replace with Session ID}</SessionID>
<Token>{Replace with Token Incremental Number}</Token>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVCurrentCompany>
{Replace with Company Name}
</SVCurrentCompany>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<COLLECTION NAME=”Collection of Ledgers” ISMODIFY=”No”>
<TYPE>Ledger</TYPE>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
In the XML request
- An export request for Collection of Ledgers from type Collection is made.
- This TDL Collection is neither available in the default Tally, nor deployed as a customized TDL at the Tally end.
- The inline XML TDL is enclosed within the <DESC> tag, and the same is associated temporarily to Tally for the purpose of exporting the data.
Note: The TDL tag within the <BODY> and <DESC> tag is not sent directly by the mobile application. The XML request received from the mobile application is added with the TDL, and its sub-tags are added by the whitelisted partner server.
Log out/Close Session
On exiting the mobile application, log out or close the remote session.
The XML request to close a session is:
HTTP Headers
ID: TPCLOSESESSION
SOURCE: <Partner Source Name>
TARGET: TALLY
CONTENT-TYPE:text/xml;charset=utf-16
XML Message
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<REQVERSION>1</REQVERSION>
<TALLYREQUEST>Execute</TALLYREQUEST>
<TYPE>Action</TYPE>
<ID>TPCLOSESESSION</ID>
<TOKEN></TOKEN>
<SESSIONID>{session id}</SESSIONID>
</HEADER>
</ENVELOPE>