Custom API for CSV?

Hello,

I may have a case where I will need to make our event data available to new service.

They appear to have fixed fields for things, like “event_title”, and expect the incoming column headers to match. However, on the default CSV feed at /live/csv/events/, the column names don’t all line up. The service doesn’t appear to have a mapping feature.

There’s potential to bridge through Google Sheets, with its own benefits/risks. If I had to, but I’d rather not for the risk of breaking.

What seems to me a cleaner approach would be a custom API defined in LiveWhale to output the exact names and data the service needs, accessed through something like /live/csv-m/events/.

Does an option to develop a custom API like this exist? If so, are there any examples or documentation for doing so? If not, then I have to look at other options for this problem, like Sheets.

Thanks,
Nick

I think you can probably customize the csv to your needs using a custom module with the onCSVOutput handler.

Hmm, the documentation notes that the handler may be limited to only “event_registrations”, “users”, or “quickaccess”. Not sure if it also includes events; I could test when/if this become a real need and not a preemptive investigation.

I’m also concerned that this would change all outputs of the given type, where I’m looking to make a custom CSV specifically for this use case.

Maybe it would just have to be a custom module or include file where event data is read and a separate, customized CSV file is built from scratch?

Nick

I didn’t notice what that handler’s limits were. That’s interesting. I suppose you could test just to make sure.

As far as limiting it to your specific CSV, you could do that in a custom module. We have created some modules in the past that check for a specific string in the live url, and then change the output if present.

You could format your url something like /live/csv/events/…/csv-m. Then your module would be set to only alter the output if “csv-m” is in the URL.