Callbacks API: RPC Spec

RPC call

A valid RPC call needs to be compliant with the JSON RPC 2.0 Specification.

Params should contain the same "result" key of synchronous message's response object.

Key

Value

Comments

method

Callback.process

undefined

params

Object with specified "result" property.

Result property value must contain the same information as response message "result" property for synchronous flow.

id

The same value as was passed during the request to shop.

Required for matching the callback and request performed earlier.

jsonrpc

A String specifying the version of the JSON-RPC protocol.

undefined

Request unique id

You must always use the same request unique id for request callback as were used for the request to shop itself.

RPC call could be performed as single request or as RPC call batch request:

{
  "jsonrpc": "2.0", 
  "method":"Callback.process",
  "params": {
    "result": [
      {  
        "status":"success",
        "product":{  
          "seller_sku":"GE526HLACPMUANPH",
          "sku":"GE526HLAE7ZWANPH-227130",
          "id":"227130",
          "config_id":"196988",
          "updated_at":"2015-08-21 17:29:50"
        }
      }
    ]
  },
  "id": "122" //This is the request unique id sent earlier
}
[
 {
    "jsonrpc": "2.0", 
    "method":"Callback.process",
    "params": {
      "result": [
        {  
          "status":"success",
          "product":{  
            "seller_sku":"GE526HLACPMUANPH",
            "sku":"GE526HLAE7ZWANPH-227130",
            "id":"227130",
            "config_id":"196988",
            "updated_at":"2015-08-21 17:29:50"
          }
        }
      ]
    },
    "id": "122" //This is the request unique id sent earlier
  },
  {
    "jsonrpc": "2.0", 
    "method":"Callback.process",
    "params": {
      "result": [
        {  
          "status":"success",
          "product":{  
            "seller_sku":"CPMUGE526HLAANPH",
            "sku":"7ZWANPHGE526HLAE-227130",
            "id":"712230",
            "config_id":"691988",
            "updated_at":"2015-08-21 17:29:51"
          }
        }
      ]
    },
    "id": "128" //This is the request unique id sent earlier
  }
]

Response object

The Response is expressed as a single JSON Object, with the following members:

Key

Description

result

This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.

error

This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation. The value for this member MUST be an Object.

id

This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.

jsonrpc

A String specifying the version of the JSON-RPC protocol.

Error response

When an​ RPC call encounters an error, the response will contain the error:

{
  "jsonrpc": "2.0", 
  "error": {
    "code": -32600, 
    "message": "Invalid Request", 
    "data":null
  }, 
  "id": null
}