HTTP GET from Tally - Whats the format of TDL?

1k Views Asked by At

I am trying to GET some data from another server into Tally via an XML API. But from the Tally documentation, I can see how to do HTTP POST. But I don't know what is the step by step process to do the HTTP GET using RemoteURL TDL instruction and pass the HTTP Header parameters. Can somebody please help? A sample would be a great help. Thanks!

2

There are 2 best solutions below

0
On

Not Working for me too..
[Collection: MakeGETRequest]
Data Source: HTTP JSON: 'http://35.198.189.9/api/Send?UserId=11&Guid=123'
JSON Object Path: "."

1
On

To fetch data from a remote URL, if you are using POST, you would need to create a report and attach it to the request - this report is actually the POST payload. POST Request:

[Collection: MakePOSTRequest]
    Data Source: HTTP JSON: <insert URL here>
    Remote Request: <insert TDL Report Name here> : UTF8
    Export Header: <Insert header here>
    JSON Object Path: "."

For GET request, you don't need anything except the URL. In case you have query parameters, attach it to the URL directly.

[Collection: MakeGETRequest]
    Data Source: HTTP JSON: <insert URL here>
    Export Header: <Insert header here>
    JSON Object Path: "."

Let's say you have one URL: http://localhost:8000/get_api_data, which accepts both POST and GET requests. Then for the POST request, you would add the parameters via the TDL report, whereas for the GET request, you'd simply add the parameters to the URL this way: http://localhost:8000/get_api_data?key1='xxx'&key2='yyy'.