public HooktrackResponse PostHookTrack(HooktrackRequest request) { WebClient webc = new WebClient(); webc.Headers["Content-Type"] = "application/json"; webc.Headers["Authorization"] = "Token " + _token; string url = @"https://trackwebhook.thailandpost.co.th/post/api/v1/hook"; string jsonRequest = JsonConvert.SerializeObject(request); string jsonResult = webc.UploadString(url, "POST", jsonRequest); var hookTrackResponse = JsonConvert.DeserializeObject <HooktrackResponse>(jsonResult); return(hookTrackResponse); }
public HooktrackResponse PostHooktrack([FromBody] HooktrackRequest request) { var response = new ThaiPostServices().PostHookTrack(request); return(response); }