FaultReporter Rest API

Is a service (Open API) used to be able to report faults to, that occurs at products out at customers that you are not administrating over. Every product need to implement a send logic to send strange exceptions.

First of you need to register a user. The email and privkey will be your private information, needed to get reports. When creating a user you will recieve a pubKey, this key is used when reporting faults from products, so email and privKey is not used from the products when reporting.

Unlicense vs License

Unlicense  account:
Faults older then 15 days will be removed
Max new Faults 10/min will is allowed to be registered

License account:
Faults older then 180 days will be removed
Max new Faults 100/min will is allowed on a registered account

Buying a Licensed account is done by contacting us with a mail, include username, email, private key. Or buying FaultViewer at Google Play


FaultViewer on Android

Want to view your faults on your Android phone?
Then it is possible to view your faults by downloading a free version of FaultViewer.
If you want to buy a license, you will get this by buying the FaultViewer and then create a user will generate a license.


Restful API

Register User

Create your user to have your personal user for all projects you will listening on faults for.

Content-Type: application/json; charset=UTF-8
Mandatory: name, email, privKey
Optional: license
Post: {“name”:”User Name”, “email”:”user@email.com”, “privKey”:”user private key”, “license”:”user license”}
Resp: {“resp”:”OK”, “code”:”200″, “error”:”message if error”}


Get User

Get your user and public Key, that is the key you will have in all projects to report fault from. Public Key is only used in our applications when reporting to this service.

Content-Type: application/json; charset=UTF-8
Mandatory: email, privKey
Post: {“email”:”user@email.com”, “privKey”:”user private Key”}
Resp: {“name”:”Your Name”,”pubKey”:”a4f3241-8edd-1d3147f69404″,”projects”:[{“name”:”Project1″,”totalReports”:6},{“name”:”Project2″,”totalReports”:16}]}



Content-Type: application/json; charset=UTF-8
Mandatory: pubKey, priority, project
Optional: title, data, severity
Post: {“pubKey”:”user pubkey”, “priority”:”1″, “project”:”projectname”, “severity”:”4″, “title”:”This is an error”, “data”:”exception”}
Resp: {“resp”:”Created”, “code”:”201″, “error”:”message if error”}


Delete Report

Content-Type: application/json; charset=UTF-8
Mandatory: privKey, email, id
Post: {“privKey”:”user privKey”, “email”:”user email”, “id”:”report id to remove”}
Resp: {“resp”:”OK”, “code”:”200″, “error”:”message if error”}


Get Reports

Content-Type: application/json; charset=UTF-8
Mandatory: privkey, project, email
Optional: limit (int), paging (int)
Post: {“privkey”:”privkey”, “project”:”name of project”, “email”:”useremail”}
Resp: [{“id”:”35937746-8357-4a64-bd23-fs981a94d154″,”project”:”Your Project”,”title”:”Exception”,”severity”:”5″,”priority”:”3″,”data”:””,”time”:”2012-03-12 14:28:20″},{…}]



Android code to send a Fault from an application:

public class FaultReporterUtil {

	private static String url_Report = "https://www.lightsoft.se/FaultReporter/API/report";

	 * Mandatory: pubKey, priority, project, severity Optional: title, data
	 * @param message
	public static void sendFault(final String project, final String title, final int priority, final String severity, final String message) {
		try {
			Runnable updateFeeds = new Runnable() {
				public void run() {
					try {
						JSONObject j = new JSONObject();
						j.put("pubKey", "a4f4abf3-4f75-44c3-8edd-1d3147f69404");
						j.put("project", project);
						j.put("priority", String.valueOf(priority));
						if (severity != null)
							j.put("severity", String.valueOf(severity));
						j.put("title", title);
						if (message != null)
							j.put("data", message);

						if (Preferences.DEBUG)
							Log.d(Preferences.TAG_Restfull, "JSON REQUEST:" + j.toString());
						String re = JSONUtil.doPost(url_Report, j, 3);
						if (Preferences.DEBUG)
							Log.d(Preferences.TAG_Restfull, "RESPONSE:" + re.toString());
					catch (Exception e) {
						Log.e(Preferences.TAG_Restfull, "JSON ERROR:", e);
			Thread thread = new Thread(null, updateFeeds, "Send FaultReport");

		catch (Exception e) {
			Log.e(Preferences.TAG_Restfull, "JSON ERROR:", e);

public class JSONUtil {

	 * Skicka JSON meddelande och gör återförsök om det misslyckas
	 * @param url
	 * @param jsonObj Insert null if not parameters should be sent
	 * @param retry if SocketException
	 * @return
	 * @throws Exception
	public static String doPost(String url, JSONObject jsonObj, int retry) throws Exception {
		Exception catchEd = null;
		for (int i = 0; i < retry; i++){
			if (Preferences.DEBUG)
				Log.d(Preferences.TAG_Restfull, "JSON Try/Retry:" + i + " : " + url);
			try {
				return doPost(url, jsonObj);	
			catch (SocketException soc){
				catchEd = soc;
		throw catchEd;
	 * Do a post to an url with JSON object
	 * @param url
	 * @param jsonObj
	 *            Insert null if not parameters should be sent
	 * @return JSONObject as response from service
	 * @throws ClientProtocolException
	 * @throws IOException
	public static String doPost(String url, JSONObject jsonObj) throws Exception {
		String result = "";
		try {

			DefaultHttpClient httpClient = (DefaultHttpClient) MySSLSocketFactory.getNewHttpClient();
			HttpParams params = httpClient.getParams();
			HttpConnectionParams.setConnectionTimeout(params, 10000);
			HttpConnectionParams.setSoTimeout(params, 10000);
			ConnManagerParams.setTimeout(params, 10000);
			HttpPost post;
			if (jsonObj != null) {
				post = new HttpPost(url + "?");
				post.setEntity(new StringEntity(jsonObj.toString(), "UTF-8"));
				post = new HttpPost(url);

			post.addHeader("Content-Type", "application/json; charset=utf-8");

			HttpResponse resp = httpClient.execute(post);
			InputStream is = resp.getEntity().getContent();
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			String line;
			while ((line = br.readLine()) != null)
				result += line;

			return result;

		catch (Exception ex) {
			throw ex;