How can I download a View with header (to create a table file) using API?
We need to analyse the views data and need it in a table like (csv) format. Right now the data available from API is json and I'm unable to ge t the header info of the views to easily create tables. How can this be done?
Stephen Kennicutt commented
Hello and thank you for your message! Due to concerns with load on our server, we don't expose a way to export a CSV via the TrackVia OpenAPI (you can imagine what would happen if we had numerous people programmatically exporting views with a large number of records on them). Depending on your goals, there are a number of options available to you in order to transform the data: First, you can pull in a 3rd party library to convert JSON to a CSV; something like https://www.npmjs.com/package/json2csv should do the trick. Second, you can write JSON to a .json file, and use an online tool to run the conversion for you. See https://json-csv.com/ for an example. Third, it sounds like you'd like to import the JSON into a SQL database. Depending on your flavor of SQL, it is possible to import JSON into a database, albeit with some effort (see https://stackoverflow.com/questions/39224382/how-can-i-import-a-json-file-into-postgresql for an example). Please feel free to reach out with any more questions or guidance!
Integrations Engineer @ TrackVia