예제 #1
0
        /// <summary>
        /// This funtion makes API call to send SMS
        /// </summary>
        /// <param name="data">JSON string</param>
        public OutboundSMSResponseObj.RootObject sendSMS(string add, string msg)
        {
            var obSMSreqObj = new OutboundSMSRequestObj.RootObject()
            {
                outboundSMSRequest = new OutboundSMSRequestObj.OutboundSMSRequest()
                {
                    address = add,
                    message = msg
                }
            };

            var serializer = new JavaScriptSerializer();
            var data       = serializer.Serialize(obSMSreqObj);

            APIRequest apiRequest = new APIRequest("outbox");

            apiRequest.accept      = "application/json";
            apiRequest.contentType = "application/json";
            apiRequest.setBinaryData(data);

            if (apiService.post(apiRequest))
            {
                OutboundSMSResponseObj responseObj = new OutboundSMSResponseObj();
                return(responseObj.deserializeOutboundSMSResponse(apiService.apiResponse.getResponseData()));
            }

            throw new Exception(apiService.errorResponse);
        }
예제 #2
0
        /// <summary>
        /// This funtion makes API call to send SMS
        /// </summary>
        /// <param name="data">JSON string</param>
        public OutboundSMSResponseObj.RootObject sendSMS(string add, string msg)
        {
            var obSMSreqObj = new OutboundSMSRequestObj.RootObject()
            {
                outboundSMSRequest = new OutboundSMSRequestObj.OutboundSMSRequest()
                {
                    address = add,
                    message = msg
                }
            };

            var serializer = new JavaScriptSerializer();
            var data = serializer.Serialize(obSMSreqObj);

            APIRequest apiRequest = new APIRequest("outbox");

            apiRequest.accept = "application/json";
            apiRequest.contentType = "application/json";
            apiRequest.setBinaryData(data);

            if (apiService.post(apiRequest))
            {
                OutboundSMSResponseObj responseObj = new OutboundSMSResponseObj();
                return responseObj.deserializeOutboundSMSResponse(apiService.apiResponse.getResponseData());
            }

            throw new Exception(apiService.errorResponse);
        }