Errors

From MyMobileWorkers API
Revision as of 13:18, 28 May 2013 by Lorritt (Talk | contribs)

Jump to: navigation, search

Exceptions are returned as a JSON response with error code and error message fields.

Example

{
   "description":"Exception containing error code and error message",
   "type":"object",
   "properties":{
      "error_code":{ "type":"string" },
      "error_message":{ "type":"string" }
   }
}


Error Codes

This a list of error codes that may be returned by the api

    	// AUTHENTICATION EXCEPTIONS
	AUT001("AUT001", "Authentication failed. Api key not provided."),
	AUT002("AUT002", "Authentication failed. Api key is incorrect."),
	AUT003("AUT003", "Authentication failed. Api key is not unique. Please contact Momote."),
 
	// BRANCH EXCEPTIONS
	BRH001("BRH001", "Branch cannot be found."),
	BRH002("BRH002", "Branch ID is invalid."),
 
	// COMPANY EXCEPTIONS
	CMP001("CMP001", "Company cannot be found."),
	CMP002("CMP002", "No transactions remaining. Please contact Momote to purchase transactions."),
	CMP003("CMP003", "Transaction error. Unable to process transaction."),
	CMP004("CMP004", "Refund transaction error. Unable to process refund."),
	CMP005("CMP005", "Company attachment could not be created. Please contact Momote."),
	CMP006("CMP006", "Company attachment file type is invalid."),
 
	// JOB EXCEPTIONS
	JOB001("JOB001", "Job cannot be found."),
	JOB002("JOB002", "Job already exists. Job number must be unique."),
	JOB003("JOB003", "Job cannot be created. Please contact Momote."),
	JOB004("JOB004", "Error deleting job. Please contact Momote."),
	JOB005("JOB005", "Job attachment could not be created. Please contact Momote."),
	JOB006("JOB006", "Job attachment file type is invalid. Must be one of the following types: png, gif, jpg, jpeg, tiff, tif, doc, docx, xls, xlsx, pps, ppt, pptx, txt, rtf, csv, rar, tar.gz, tgz, zip, pdf."),
	JOB007("JOB007", "Only one Gas Safe Inspection should be present when creating a Gas Safe job."),
	JOB008("JOB008", "Gas Safe Inspection can only be added to a Gas Safe job."),
	JOB009("JOB009", "Gas Safe Inspection required when creating a Gas Safe job."),
	JOB010("JOB010", "Job status not provided. Please specify status in request."),
	JOB011("JOB011", "Job number not provided. Please specify job number in request."),
 
	//Customer Exception
	CUS001("CUS001", "Customer could not be created"),
	CUS011("CUS011", "Customer name not provided. Please specify customer name in the request."),
	CUS002("CUS002", "Customer cannot be found"),
 
	WAC005("WAC005", "Customer name invalid size"),
	WAC006("WAC006", "Contact name invailid size"),
	WAC007("WAC007", "address invailid size"),
	WAC008("WAC008", "address invailid size"),
	WAC009("WAC009", "address invailid size"),
	WAC010("WAC010", "address invailid size"),
	WAC011("WAC011", "Postcode invalid"),
	WAC012("WAC012", "Customer number invalid"),
	WAC013("WAC013", "Customer number invalid"),
	WAC014("WAC014", "Created at time not vailid"),
	WAC015("WAC015", "Customer must relate to a company"),
 
 
	// JOB ITEM EXCEPTIONS
	JIT001("JIT001", "Job items could not be created. Please contact Momote."),
	JIT002("JIT002", "Job items can only be added to a PODC job."),
 
	// JOB PART EXCEPTIONS
	JPR001("JPR001", "Job parts could not be created. Please contact Momote."),
	JPR002("JPR002", "Job parts can only be added to a Repair job."),
 
	// MOBILE USER EXCEPTIONS
	MBU001("MBU001", "Mobile user cannot be found."),
	MBU002("MBU002", "Mobile user's username not provided. Please include username in the request."),
 
	// USER EXCEPTIONS
	USR001("USR001", "Default user cannot be found."),
	USR002("USR002", "More than one default user found. Please contact Momote."),
 
	// DATETIME EXCEPTIONS
	DTE001("DTE001", "Date is invalid. Date must be formatted as 'yyyy-MM-dd'."),
	DTE002("DTE002", "Timestamp is invalid. Date must be formatted to ISO8601 spec 'yyyy-MM-ddTHH:mm:ssZ'."),
	DTE003("DTE003", "Start date not provided. Please specify start date in request."),
	DTE004("DTE004", "End date not provided. Please specify end date in request."),
	DTE005("DTE005", "Date not provided. Please include date in the request."),
 
	// FILE EXCEPTIONS
	FLE001("FLE001", "File cannot be created. Error saving file."),
	FLE002("FLE002", "Error opening file."),
	FLE003("FLE003", "Error reading file."),
	FLE004("FLE004", "File cannot be deleted. Error deleting file."),
	FLE005("FLE005", "File upload failed. File size has exceeded 5MB limit."),
	FLE006("FLE006", "File upload failed. Required directories cannot be created. Please contact Momote."),
	FLE007("FLE007", "File not provided. Please include file in the request."),
 
 
	// JOB VALIDATION
	WAJ003("WAJ003", "job_number already exists"),
	WAJ004("WAJ004", "job_number invalid empty string"),
	WAJ005("WAJ005", "job_number invalid length"),
	WAJ006("WAJ006", "address1 invalid empty string"),
	WAJ007("WAJ007", "address1 invalid length"),
	WAJ008("WAJ008", "postcode invalid empty string"),
	WAJ009("WAJ009", "postcode invalid length"),
	WAJ010("WAJ010", "contact_name invalid empty string"),
	WAJ011("WAJ011", "contact_name invalid length"),
	WAJ012("WAJ012", "timeslot invalid empty string"),
	WAJ013("WAJ013", "timeslot already expired"),
	WAJ014("WAJ013", "cannot create job without a valid mobile user"),
	WAJ018("WAJ018", "address2 invalid length"),
	WAJ019("WAJ019", "address3 invalid length"),
	WAJ020("WAJ020", "address4 invalid length"),
	WAJ021("WAJ021", "contact_number_1 invalid length"),
	WAJ022("WAJ022", "contact_number_2 invalid length"),
	WAJ023("WAJ023", "special_instructions invalid length"),
	WAJ024("WAJ024", "notes invalid length"),
	WAJ025("WAJ025", "type invalid length"),
	WAJ026("WAJ026", "product invalid length"),
	WAJ027("WAJ027", "fault invalid length"),
	WAJ028("WAJ028", "repair_code invalid length"),
	WAJ029("WAJ029", "repair_description invalid length"),
	WAJ030("WAJ030", "signee invalid length"),
	WAJ031("WAJ031", "failure_type invalid length"),
	WAJ032("WAJ032", "name invalid empty string"),
	WAJ033("WAJ033", "name invalid length"),
	WAJ034("WAJ034", "description invalid empty string"),
	WAJ035("WAJ035", "description invalid length"),
	WAJ036("WAJ036", "quantity invalid number"),
	WAJ037("WAJ037", "code invalid empty string"),
	WAJ038("WAJ038", "code invalid length"),
	WAJ039("WAJ039", "created_at invalid empty date"),
	WAJ040("WAJ040", "updated_at invalid empty date"),
	WAJ041("WAJ041", "type invalid"),
	WAJ042("WAJ042", "Job not in an editable state"),
	JBE001("JBE001", "NULL"),
	JBE002("JBE002", "NULL"),
	JBE003("JBE003", "NULL"),
	JBE004("JBE004", "Postcode missing."),
	JBE005("JBE005", "NULL"),
	JBE006("JBE006", "NULL"),
	JBE007("JBE007", "NULL"),
	JBE020("JBE020", "Contact Number 1 invalid phone number"),
	JBE021("JBE021", "Contact Number 2 invalid phone number"),
	JBE100("JBE100", "Job cannot be found."),
 
	// JOB ITEMS VALIDATION
	JBI001("JBI001", "Job item name is null"),
	JBI002("JBI002", "Job item type is null"),
	JBI003("JBI003", "Job item status is null"),
	JBI004("JBI004", "Job item other is null"),
	JBI005("JBI005", "Job item job_id is null"),
	JBI006("JBI006", "Job item name is invalid"),
	JBI007("JBI007", "Job item type is invalid"),
	JBI008("JBI008", "Job item status is invalid"),
	JBI009("JBI009", "Job item other is invalid"),
	JBI010("JBI010", "Job item notes is invalid"),
 
	// JOB GAS SAFE INSPECTION VALIDATION
	JBG001("JBG001", "Owner title cannot exceed 45 characters."),
	JBG002("JBG002", "Owner name cannot be empty."),
	JBG003("JBG003", "Owner name cannot exceed 45 charaters."),
	JBG004("JBG004", "Owner address 1 cannot be empty."),
	JBG005("JBG005", "Owner address 1 cannot exceed 45 characters."),
	JBG006("JBG006", "Owner address 2 cannot exceed 45 characters."),
	JBG007("JBG007", "Owner address 3 cannot exceed 45 characters."),
	JBG008("JBG008", "Owner address 4 cannot exceed 45 characters."),
	JBG009("JBG009", "Owner postcode cannot be empty."),
	JBG010("JBG010", "Owner postocde cannot exceed 45 characters."),
	JBG011("JBG011", "Owner contact number cannot exceed 45 characters."),
	JBG012("JBG012", "Pipework visual cannot be empty."),
	JBG013("JBG013", "Pipework visual cannot exceed 3 characters."),
	JBG014("JBG014", "Pipework accessible cannot be empty."),
	JBG015("JBG015", "Pipework accessible cannot exceed 3 characters."),
	JBG016("JBG016", "Pipework tightness cannot be empty."),
	JBG017("JBG017", "Pipework tightness cannot exceed 3 characters."),
	JBG018("JBG018", "Pipework bonding cannot be empty."),
	JBG019("JBG019", "Pipework bonding cannot exceed 3 characters."),
	JBG020("JBG020", "Received by cannot exceed 45 characters."),
	JBG021("JBG021", "Customer email cannot exceed 255 characters."),
	JBG022("JBG022", "Owner email cannot exceed 255 characters."),
	JBG023("JBG023", "Paper copy cannot exceed 3 characters."),
	JBG024("JBG024", "Electronic copy cannot exceed 3 characters."),
	JBG025("JBG025", "Engineer signee cannot exceed 45 characters."),
 
	//JOB ATTACHMENTS NOT FOUND EXCEPTION
	JBA026("JB0026", "Job attachment not found"),
 
	//JOB DELETION ERRORRS
	JBG027("JBG027", "Job removal failed")
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox