Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

GST Report

Started by Steve Fewster -   in Wrapper libraries

Hi

I have the need to execute a GST Report through a .net application. I can see from the documentation that the report is available via the API, but I'm unclear about the Urls required.

I would prefer to call through XeroAPI.Net and am happy to make the required modifications to make it work, but am also happy to call in any way that will get the the results I need.

I hope you can help.

Thanks

Hi Steve,

There is an explanation on retrieving published GST Reports at the article below.
Xero Developer Center: GST Report
 

W. Abdullah (Community Manager)  

Hi Welli,

This is the standard API call, do you have anything referring to the .net wrapper ?

Thanks

Steve
 

Steve Fewster  

Hey Steve,
The GST Report (like a few others) is a published report, so you don't get to execute it, you just retreive a previously published version.

Use the GetPublishedReport method in the ReportRepository to do this. You can also list all available published reports with ListAllPublishedReports.

See: https://github.com/XeroAPI/XeroAPI.Net/blob/master/source/XeroApi/ReportRepository.cs

Not every published report appears to be available via the API though.

Good luck,
Ruairi
 

Ruairi M  

Hi Ruairi

Thanks for the information. Is it possible to call GetPublishedReport for a report without a Guid ID? The reports I'm trying to retrieve have a numeric ID instead.

Interestingly, I have three published reports within Xero, two of which have Guid IDs (neither of which I need) and one with a numeric ID. Within the XeroAPI.Net, I can only see the report with the numeric ID, neither of the other two are returned by ListAllPublishedReports.

Thanks

Steve
 

Steve Fewster  

Hi Steve

They don't sound like published New Zealand GST or Australian BAS reports - this feature does not work for all published reports.

Ronan
 

Ronan Quirke (Community Manager)  

Hi Ronan,

In my list of Published reports from the Demo NZ Company. I have the following to support my earlier post.

GST Report which takes me to the following link.
https://go.xero.com/Reporting/ReportCentre/FindPublished/34887
Profit & Loss
https://go.xero.com/Reports/report2.aspx?reportId=b275fbd0-4282-466b-8d5f-4c12644f0c4b
Invoices
https://go.xero.com/Reports/report2.aspx?reportId=4666c57b-3df9-41ae-befc-531dc475e4ab

Cheers

Steve
 

Steve Fewster  

Hi Steve

Great, so it looks like you have an NZ GST return published in the application to work with.

Via the previewer then, if you do a GET Reports (without entering/selecting in the 'Report Id/Name' field), it will return a list of reports that are accessible via the API. In your case, it should only be the first report with the numeric value (34887) in the ReportID element.

Taking this, you can enter it into the the 'Report Id/Name' field and run that. This has the effect of running the request GET /Reports/100443, returning the full report data. It does not need to be a Guid, just the value returned in the ReportID field on GET Reports.

Ruairi has given some good pointers on how you can translate that to XeroAPI.Net - let us know how you get on.

Ronan
 

Ronan Quirke (Community Manager)  

@Steve,
I'd imagine you'd have to overload the GetPublishedReport(Guid reportId) method to:
GetPublishedReport(string reportId) in the wrapper.

@Ronan
Bit of an odd design choice to have reports that can be referenced as Guids or Integers when getting the published instances. Is there a reason for the inconsistancy?

Also, would you consider exposing the logic in "http://go.xero.com/Reports/report2.aspx" to the API? Would be nice to have an API endpoint that I could use the same parameters as the website and it return the same report as the export does.
 

Ruairi M