Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ** Interface **
- public interface IAPIHelper
- {
- //RESTFul API
- [FaultContract(typeof(RequestValidationFault))]
- [WebInvoke(UriTemplate = "/ByteFromCaseData", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
- [OperationContract]
- byte[] ByteFromCaseData(ByteFromCaseDataRequest caseData);
- }
- *** Data contract ***
- [DataContract]
- public class ByteFromCaseDataRequest
- {
- [DataMember]
- public Dictionary<string, string[]> HashMap;
- }
- ***Implementation****
- [ServiceBehavior]
- [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
- public class APIHelper : IAPIHelper
- {
- public byte[] ByteFromCaseData(ByteFromCaseDataRequest caseData)
- {
- // Business Logic
- }
- }
- json request -
- {
- "HashMap" : {"key1":["1.1","1.2"],"key2":["2.1","2.2"],"key3":["3.1","3.2"]}
- }
- {
- "HashMap" : [
- {"Key": "key1", "Value": ["1.1","1.2"]},
- {"Key": "key2", "Value": ["2.1","2.2"]}
- ]
- }
Add Comment
Please, Sign In to add comment