Hi there. I have a fairly open-ended question I hope someone can help with. I’m building a custom CMS for a client with the ability for them to ‘deploy’, via a build hook, and want to be able to show the deploy status.
Reading this thread, it seems there’s currently no way to get push notifications for deploy status in the browser. I can think of a couple of workarounds:
- Maybe Netlify has endpoints where I can find out deploy status from via get requests (I’ve looked but can’t find anything on this)?
- Send a notification via an ‘outgoing webhook’ to update the database with deploy status - then either (a) periodically send get requests from the frontend to this endpoint (b) somehow listen for changes to the database.
It’d be great to get advice on what is a possible solution to this problem.
Would a Deploy Status Badge help? It’s available here:
That’s awesome thanks! Is there any secure way of knowing the status without showing the image? I could probably derive the status by accessing the colours used in the image but this doesn’t seem very secure.
Not perfectly sure, but this might help: https://open-api.netlify.com/#operation/listSiteDeploys. You can get the response in JSON. The part you’re looking for is `state. Like this: https://docs.netlify.com/api/get-started/#poll-for-deploy-state
Hi, @_Lato_X, you can also look at the filename in the
content-disposition HTTP response header. Here is an example of that header below:
$ curl -svo /dev/null https://api.netlify.com/api/v1/badges/fe21b1ce-1d9a-4899-bbff-a0d7bcb55ad0/deploy-status 2>&1 | egrep 'content-disposition'
< content-disposition: inline; filename="badge-success.svg"; filename*=UTF-8''badge-success.svg
The filename in the header will also tell you the status.