Guest User

Untitled

a guest
May 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. ** Interface **
  2. public interface IAPIHelper
  3. {
  4. //RESTFul API
  5. [FaultContract(typeof(RequestValidationFault))]
  6. [WebInvoke(UriTemplate = "/ByteFromCaseData", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
  7. [OperationContract]
  8. byte[] ByteFromCaseData(ByteFromCaseDataRequest caseData);
  9. }
  10.  
  11. *** Data contract ***
  12.  
  13. [DataContract]
  14. public class ByteFromCaseDataRequest
  15. {
  16. [DataMember]
  17. public Dictionary<string, string[]> HashMap;
  18. }
  19.  
  20.  
  21. ***Implementation****
  22.  
  23. [ServiceBehavior]
  24. [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  25. public class APIHelper : IAPIHelper
  26. {
  27. public byte[] ByteFromCaseData(ByteFromCaseDataRequest caseData)
  28. {
  29. // Business Logic
  30. }
  31. }
  32.  
  33. json request -
  34. {
  35. "HashMap" : {"key1":["1.1","1.2"],"key2":["2.1","2.2"],"key3":["3.1","3.2"]}
  36. }
  37.  
  38. {
  39. "HashMap" : [
  40. {"Key": "key1", "Value": ["1.1","1.2"]},
  41. {"Key": "key2", "Value": ["2.1","2.2"]}
  42. ]
  43. }
Add Comment
Please, Sign In to add comment