TheAlphaSchoolSystemPTYLTD / api-introduction

A basic introduction to the TASS API's.
16 stars 10 forks source link

Is there a way to get the error response in JSON? #12

Closed team-hq closed 4 months ago

team-hq commented 3 years ago

Right now the, when I get a 403 or 501, the error response is in HTML and the JSON response in appended to the end of the HTML. Is there a way to a clean JSON response? I have 'content-type': 'application/json' inside my header. Is there something else one needs to do?

This is the current response and it's hard to parse:

'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>\r\n<title>403 - Forbidden: Access is denied.</title>\r\n<style type="text/css">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7em;margin:0;color:#CC0000;} \r\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \r\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;\r\nbackground-color:#555555;}\r\n#content{margin:0 0 0 2%;position:relative;}\r\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\r\n-->\r\n</style>\r\n</head>\r\n<body>\r\n<div id="header"><h1>Server Error</h1></div>\r\n<div id="content">\r\n <div class="content-container"><fieldset>\r\n <h2>403 - Forbidden: Access is denied.</h2>\r\n <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>\r\n </fieldset></div>\r\n</div>\r\n</body>\r\n</html>\r\n{"__status":"invalid","__msg":"A Security Role must be defined in the TASS.web API configuration for Version 3 and above.","__invalid":{}}'

scottetass commented 4 months ago

JSON is getting returned when an error is raised now.

image

As this is a very old issue, I am going to close it. If the problem still persists, please re-open this item.