ionic-team/legacy-ionic-cloud

HTML error response in api.ionic.io

Opened this issue · 0 comments

Today the API was down due to maintenance, responding with an error message.

In my backend, which uses PHP, I call some endpoints with CURL.
In a normal service status this is working perfectly, but today within this maintenance window I was getting pure HTML instead of JSON.

This was the result of curl_exec:

<!DOCTYPE html>
<html>
  <head>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta charset="utf-8">
	<title>Offline for Maintenance</title>
	<style media="screen">
	  html,body,iframe {
		margin: 0;
		padding: 0;
	  }
	  html,body {
		height: 100%;
		overflow: hidden;
	  }
	  iframe {
		width: 100%;
		height: 100%;
		border: 0;
	  }
	</style>
  </head>
  <body>
	<iframe src="https://api.ionic.io/_errors/503"></iframe>
  </body>
</html>

Look at the iframe tag. This was indeed the proper JSON response:

{
  "error":
  {
    "link":"https://status.ionic.io",
    "message":"The Ionic API is temporarily unavailable. Check our status page for details.",
    "type":"ServiceUnavailable"
  },
  "meta":
  {
    "request_id":"47c8d965-d089-4a98-cab8-fdf96f0e875f",
    "status":503,
    "version":"2.0.0-beta.0"
  }
}

I think that it should be presented as raw text, not with HTML and CSS formatting.
Let me know what you think.
Thanks!