Formatting GET API responses

Hi All,

Enthused by my experience of Retool of late (developing an internal app) - I wanted to have a shot at a personal project. But, I am not a developer........ so I need a little steer in the right direction.

  • I am on an hourly electricity tariff at home. And I have an electric car.
  • I've found a way to access the car via an API, and I have found the hourly tariff rates in an Energy API.
  • I wanted to create a little app that will only charge the car when hourly tarrifs are below certain amount.

I've got as far as getting my API pulling the correct data (using GET - to get the tariff rates) - but, it just comes back as a raw xml file. I'm sure this is normal and standard - but, as mentioned, I'm not really a developer - so I wanted to ask......where should I be looking to get some guidance on how to then format this into a useable set /table of data? What should I search for?

As always, appreciate any guidance - many thanks!
Neil

Woah cool use case @maillme! We have a feature request on file to build in better support for xml responses. I'll post back here if we're able to fulfill that request.

In the meantime, this is doable with some Javascript code.

I followed this community post to get started.

  1. Import the fast xml parser library (or any xml parsing library that you prefer) using these instructions
  2. Add a transformer to your query that parses the xml. The code may look slightly different for your app, but here's an example:

I've attached this sample app if you'd like to import it to your instance & test it out
xml-20parsing (1).json

2 Likes

Tess,

thank you. This will be enough to get me started. I appreciate the steer,
Neil

1 Like

Slowly but surely getting there :slight_smile:

Awesome! :raised_hands: Let us know if any questions come up

1 Like