42
What's the best way to monitor an API for breaking changes?
(sh.itjust.works)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
So to sum it up:
You're out of luck. You can't prevent it. You can't foresee it, unless you know beforehand what you'll call the API with and you can pre-flight it and detect it earlier.
Luckily the only thing I ever pass it are dates and host IDs. I can check a known input against the known response, but my problem so far hasn't been them breaking their database but breaking the new data being added or the API itself.
Yeah, it's a tough one.
Preflight it? If you ask external API every 6 hours about known range of host IDs with a date, then 1h before you need that information call the external API and check if it works or returns garbage? That way you can get some extra time to maybe react earlier to an incident? It honestly depends on the nature of your job and the qualities of your traffic, but generally speaking the problem you have is unfixable and the best you can hope for is early detection (if that matters for you).
If however you're a pass-through API to the external one, eg. a different service calls your API with a hostID and the hostIDs are not a known finite pool, then you can forget about preflighting.