This is a specific tool built for tracking changes in API endpoints, specifically to support the developer community that uses the NHL API regularly and has been plagued by constant changes.
- requests
- thats it! (the rest should be there by default)
Populate endpoints.txt with whatever endpoints you want, currently this only supports HTTP GET calls, maybe later it can do more
and then run it with python app.py. What happens then is this general flow loops over the endpoints, makes a GET to them and
then computes the sha256 from the response.text and stores it in two places, one is results.txt in a format like the following
{'url': 'https://jsonplaceholder.typicode.com/posts/1', 'code': 200, 'sha': '965636bd900078aa86a714aea4de146af6d396205d5100636f1bdd2454f73420'}
And then it writes the entire contets of response.txt as a filename using the sha256 in files/ like files/965636bd900078aa86a714aea4de146af6d396205d5100636f1bdd2454f73420.json
so that if you happen to detect a drift in responses you can review the two JSON files and determine exactly what changed.
Here is what it looks like when changes are detected, it doesnt say anything if no drift found
$ python app.py
CHANGE DETECTED!
URL: https://api.github.com/zen
Old SHA: cb855abd824d747aca7e5909ed9c19f70b970e8d563b9b1e031a1fd759e3f5f9
New SHA: a6567804b19d46bcaa88c9d21dd20b939813f015eed613f6a35fe44ed223da82
CHANGE DETECTED!
URL: https://api.nhle.com/stats/rest/application.wadl?detail=true
Old SHA: fa491ac84242806baa769404d9ae1d1d7e1e4dd19e9455c3b8de60ced9b7da58
New SHA: fbfcac941fac4b8d7ce0c58f4c5e105953376b93ffdc36b97a65efa226ad5095- add support for other calls besides GET
- maybe notifications?
- auto-diff of changes detected
- housekeeping and guardrails (limits on number and size of files)