JSON Web Services

The JSON Web Services standard specifies a uniform way of exchanging data over HTTP.

Date: 26 December 2014

Version: 2.0

Introduction

The latest trends in software development show that needs for reliable data exchange is on increase. Of all the formats, JSON provides the required reliability by mostly being compact, human-friendly, and difficult to misinterpret due to the known UTF-8 encoding. Despite the fast adoption, very little effort has been put to set a standard, and multiple web services have grown up, each using its own principles. As a result, instead of being a unifying factor, these different services quickly become a hurdle to quick adoption.

The JSON Web Services standard aims o set a uniform way to exchange data over HTTP, and bring down the time required for external consumers to use the provided resources.

Response Format

Following is the format which SHOULD BE used be the JSON web services compliant with the standard.

{
    "status":"success",
    "message":"User successfully found",
    "data":{
        user:{"ID"=>"2", "Name"=>"Smith"}
    }
}

The web services are ENCOURAGED to provide both JSON and JSONP response, if the end-user requests.

Request Format

The web service SHOULD provide HTTP based endpoint(s) to end-user to interact with. The endpoints SHOULD be able to accept the issued command, and provide a meaningful response. (Note. REST-full HTTP interface SHOULD NOT be used).

Example Request and Responses

Request:
webservice_endpoint?command=getUser&userID=2

Response, if user found:
{
    status:"success",
    data:{
        user:{"ID"=>"2", "Name"=>"Smith"}
    }
}

Response, if user not found:
{
    status:"success",
    data:{
        user:null
    }
}

Response, if request failed:
{
    status:"error",
    message:"Command getUser DOES NOT exist"
}