2

While making an API call from swagger-ui, with content type "application/json", it is working fine. But when the same API is being called from below specified code, shows 404 StatusCode . What could be the possible reasons for it? Also, few other APIs from the same swagger-ui, are when being called from the code, they work from this same code.

                var serialized = JsonConvert.SerializeObject(data);
                String uri = GetEndpointUrl(path);
                String responseData = "";
                var buffer = System.Text.Encoding.UTF8.GetBytes(serialized);
                var byteContent = new ByteArrayContent(buffer);
                byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                client.Timeout = TimeSpan.FromSeconds(120);

                var response = client.PostAsync(uri, byteContent).Result;
                responseData = await response.Content.ReadAsStringAsync();

0 Answers0