Hi
I am using NimbusPost manifest APi. It is getting blank file downloaded
public void Manifest(string awb, string token) { var client = new RestClient("htps://api.nimbuspost.com/v1/shipments/manifest"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); string awbNo = awb; string val1 = "NMBC0001789312"; var body = $@"{{ ""awbs"": [ ""{awbNo}"", ""{val1}"" ] }}"; request.AddParameter("application/json", body, ParameterType.RequestBody); request.AddHeader("Authorization", "Bearer " + token); IRestResponse response = client.Execute(request); dynamic json = JsonConvert.DeserializeObject(response.Content); string pdf = json.data; string s = pdf; int idx = s.LastIndexOf('/'); string fileName = s.Substring(idx + 1); using (var client5 = new System.Net.WebClient()) { byte[] bytes5 = client5.DownloadData(pdf); File.WriteAllBytes(Server.MapPath("~/App_Data/") + fileName, bytes5); } }
Thanks