status codes in rest api code example

Example 1: api error codes

General (unknown) error.	                              = 500
	Customer account not found (possible bad subdomain	      = 401
	Customer account inactive	                              = 401
	Customer account suspended	                              = 503
	Customer account banned	                                  = 418
	Paid customer account inactive due to non-payment	      = 402
	User not found	                                          = 401
	User not active	                                          = 401
	Invalid auth (bad username/password)	                  = 401
	Permissions error.                    	                  = 403
	Maximum number of daily API requests exceeded          	  = 400

Example 2: api response

Response 
				
				 Status code 
				 			2xx -->>  success 
				 			4xx -->>  client side error
				 			5xx -->>  server side error 
				 Header 
				 		meta data about your response 
				 		like Content-Type, Date and some other info

				 Body | Payload		
				 		The response we got from the server 
				 		and this where we do lots of validation

Tags:

Misc Example