APIResponse

APIResponse Response to API web-method calls.
This structure can be presented in XML or JSON string depending on value of outputFormat input parameter.
APIResponse data has the following elements:
Name Type Desciption
result(data)Call result data
result.value(string)Result code (numberic value). See each method or function for all possible return values
result.description(string)Result description
request(string)Name of function called. Can be used to determine format of payload element
apiInfo(object)Server and API information
apiInfo.version(string)SageBridge API version
apiInfo.protocolVersion(string)Format of data included in payload element. Currently 2.1
apiInfo.serverLocalTime(timestamp)Server local time
apiInfo.encryption(bool)(false/true) - payload encryption indicator. Contact us for details about encryption
apiInfo.licenseExpire(timestamp)License expiration timestamp. This element will have a value only if valid credentials are provided
transactionId(string)Unique transaction identifier. Every SageBridge API response will have a unique value that can be used for logging or referencing needs
hash(string)SHA512 hash of payload element, represented as Base64 string
payload(string)Data requested in executeAPICall() web-method. The format of data depends on function called. See specific function help for examples of payload
Notes:
  • Payload string represents already serialized objects in so-called "escaped" form
  • After deserializing APIResponse, take payload string and deserialize it again to a data specific for a given function.
  • Some API functions may have internal errors/validation codes, even if result.value is '0'.

XML output example:
JSON output example:

{
 "result":{
    "value":"0",
    "description":"New token issued"},
 "request":"getSecurityToken",
 "apiInfo":{
    "version":"1.2.1234.5678",
    "protocolVersion":"2.1",
    "licenseExpire":"12/31/2015 23:59:59",
	"encryption":"false",
    "serverLocalTime":"01/01/2015 18:24:06"},
 "transactionId":"4002cd00-db65-4a08-8e4c-a96cf4800f31",
 "hash": "KzngQuAaw6p8upeTCzQ6C4Bqka7OHazkhX4qbLWlf8Qo4J4HdBRmiDFeUNQPBROO7pCkMA1c6X0pRK0mQQdw1A==",
 "payload":"---PAYLOAD ELEMENTS---"
}

Possible return codes
  • 0 - Success. Description may vary by function
  • -1 - General error. Description attribute will show more details about an error
  • -2 - Function is not supported
  • 500 - Invalid credentials provided
  • 501 - License is expired
  • 502 - License is not active
  • 503 - Token is not active or expired
  • 550 - Unknow functionName or not subscribed
  • 551 - Unknown practice
  • 552 - No Subscription found
  • 553 - Subscription is inactive or expired
  • 600 - Invalid or empty request parameters
  • 601 - No valid route found for this subscription
  • 602 - Unable to parse request parameters

Source Code (C#):
// 
using System.Xml;
using System.Xml.Serialization;

   [XmlRoot(ElementName = "APIResponse")]
    public class SageBridgeAPIResponse 
    {
        [XmlElement(ElementName = "result")]
        public SageBridgeAPICallResult result { get; set; }
        [XmlElement(ElementName = "request")]
        public string request { get; set; }
        public SageBridgeAPIInfo apiInfo { get; set; 
        public string transactionId { get; set; }
        public string hash { get; set; }
        public string payload { get; set; }       
    }

    public class SageBridgeAPICallResult
    {
        [XmlAttribute]
        public string value;
        public string description;
    }

    public class SageBridgeAPIInfo
    {
        [XmlAttribute]
        public string version { get; set; }
        [XmlAttribute]
        public string protocolVersion { get; set; }
        [XmlAttribute]
        public string licenseExpire { get; set; }
        [XmlAttribute]
        public string serverLocalTime { get; set; }
        [XmlAttribute]
        public string encryption { get; set; }
    }
//

Notes:
None
See Also:
executeAPICall() method, API Functions, API Data