Skip to content

Graphviz API Error Handling

jvelilla edited this page Dec 14, 2012 · 4 revisions
  • Resource not found

      	{ "collection" :
      	  {
      	    "version" : "1.0",
      	    "href" : "...",
    
      	    "error" : {
      	      "title" : "Resource Not Found",
      	      "code" : "001",
      	      "message" : ""
      	    }
      	  } 
      	}
    
  • Method not allowed

      	{ "collection" :
      	  {
      	    "version" : "1.0",
      	    "href" : "...",
    
      	    "error" : {
      	      "title" : "Method not allowed",
      	      "code" : "002",
      	      "message" : ""
      	    }
      	  } 
      	}
    
  • Forbidden

      	{ "collection" :
      	  {
      	    "version" : "1.0",
      	    "href" : "...",
    
      	    "error" : {
      	      "title" : "Forbidden",
      	      "code" : "003",
      	      "message" : ""
      	    }
      	  } 
      	}
    
  • Unauthorized

Suppose that we want to login to the server, but we don't provide our credentials (the current implementation uses Basic Authentication).

Request

    GET http://www.graphviz.org/login
   
    using cURL

    curl -i -H "Accept: application/json" http://127.0.0.1:8190/login  

Response

HTTP/1.1 401 Unauthorized
Content-Type: application/vnd.collection+json
Content-Length: 541
Date: FRI, 14 DEC 2012 11:34:56 GMT
WWW-Authenticate: Basic realm="User"
Connection: close

Body of the response, something like the following.

		{ "collection" :
		  {
		    "version" : "1.0",
		    "href" : "...",

		    "error" : {
		      "title" : "Unauthorized",
		      "code" : "004",
		      "message" : ""
		    }
		  } 
		}
  • Bad Request

      	{ "collection" :
      	  {
      	    "version" : "1.0",
      	    "href" : "...",
    
      	    "error" : {
      	      "title" : "Bad Request",
      	      "code" : "005",
      	      "message" : ""
      	    }
      	  } 
      	}
    
  • Internal server error

      	{ "collection" :
      	  {
      	    "version" : "1.0",
      	    "href" : "...",
    
      	    "error" : {
      	      "title" : "Internal server error",
      	      "code" : "006",
      	      "message" : ""
      	    }
      	  } 
      	}
    
  • Conflic

      	{ "collection" :
      	  {
      	    "version" : "1.0",
      	    "href" : "...",
    
      	    "error" : {
      	      "title" : "Conflic",
      	      "code" : "007",
      	      "message" : ""
      	    }
      	  } 
      	}
    
Clone this wiki locally