Questions tagged [postasync]

21 questions
1
vote
2 answers

C# HTTPClient PostAsync does not send data

I have the following code to send an HTTP request, but it does not transmit any packets (checked using Wireshark). var httpClient = new HttpClient(); string uri = "http://" + IP + ":" + port + "/"; var stringContent = new…
Groot
  • 311
  • 4
  • 15
1
vote
1 answer

How to get string response from generic asyn method

I am working on application which I have implemented a generic method which gets me response and serialize that response into response model. I am checking for error codes where I need to get the reason phrase which I want to return and to show to…
1
vote
1 answer

C# Post Variables can't be read on Website - HttpClient PostAsync()

I have a web server on which I'm hosting my own api for one of my projects. This is the php-code of the api-website: $user = $_POST['username']; $password = $_POST['password']; if(strcmp($user, "username") == 0 && strcmp($password, "password") == 0)…
user-C137
  • 11
  • 1
1
vote
0 answers

How to pass an object (csv file) to HttpClient.PostAsync as a JSON body?

I am doing the test automation of a post request that takes a csv file (form data in postman) and returns a list. I want to add a csv file as an object in the body of the postasync request in my code. However, I would like to know how to add the…
Wiss
  • 11
  • 3
1
vote
4 answers

C# different return types based on try-catch

I'm calling API in one of my Service classes as below: public GetCustomerApiResponse SearchCustomerByEmail(string email) { GetCustomerApiResponse customerApiResponse = null; try { var…
Unknown Coder
  • 1,510
  • 2
  • 28
  • 56
0
votes
0 answers

C# How to call a post API by "PostAsJsonAsync" when the specification of header and body of this API is given?

I am learning to use API and I have been given the specification of the URL, header and body of an API. The example is shown as follow url: api/getRate hearder:{ "msgNo": "abc123", "receiver": "Customer_A" } body:{ "dateTime": "2023/08/19…
0
votes
1 answer

Web API - Problem with PostAsync (http Rest) calls

Good morning, I have a big problem with routing (I guess) for http Post calls. I use .Net 6. I have the following call which works fine: HttpResponseMessage response1 = await client.GetAsync("http://localhost:6000/api/" +…
0
votes
1 answer

PostMan Token works but source code has error: The request was aborted: Could not create SSL/TLS secure channel during trace

I have a code for getting token. It works in live server. But when I am tracing the code in my system I get this error: The request was aborted: Could not create SSL/TLS secure channel When I try to get token by Postman on my system, no error…
0
votes
1 answer

HttpClient PostAsJsonAsync not working in Framework 4.6

I don't what it is, but the moment I run my project in debug mode and hits this line within PingServerAsync(): var response = await httpClient.PostAsJsonAsync(url, payload); it hangs for a sec, then just exists out with no response value. It's NOT…
bob.mazzo
  • 5,183
  • 23
  • 80
  • 149
0
votes
1 answer

How to use a string already urlencoded on PostAsync?

I'm getting the body using a proxy on my computer which gets all specific requests I made to a specific host and resend them to the server using PostAsync. The body looks like this: string request_body =…
SrMilton
  • 45
  • 6
0
votes
1 answer

Woocomerce : Update a product doesn't work

I'm trying to update a product's informations to the WooCommerce shop, from a windows service as follows: using (var client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Clear(); …
Nissanna
  • 1
  • 3
0
votes
1 answer

Post Request responded 500 on HTTPClient in Asp .net Core

Request Response: {StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { Transfer-Encoding: chunked Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET Date:…
Md Safiul Alam
  • 153
  • 1
  • 6
0
votes
1 answer

Roblox - Call external GraphQL API

I would like to call an external graphql API (without authentication for the moment). Here is my code : local open_api = "https://graphqlzero.almansi.me/api" local payload = '{"query": "query { post(id: 1) { id title body }}"}' local headers =…
emilie zawadzki
  • 2,035
  • 1
  • 18
  • 25
0
votes
0 answers

HTTPClient.PostASync() method is not working with body information in C#, But working fine with Postman and Talend tools

I have to use httpClient.PostASync() method in C#.Net , I am fine with passing header information. but I am getting trouble while trying to pass the "Body" information, under a specific condition. this is working fine in Postman and Talend API…
0
votes
1 answer

C# application hangs during POST request to python http server

I have a C# app that makes a post request to a simple http server created in Python but my request never "finishes" and doesn't progress past the point of making an asynchronous POST request. This is the call I'm making from my client (C#…
Isaac Perez
  • 570
  • 2
  • 15
  • 31
1
2