question

JassimAlRahma-9056 avatar image
0 Votes"
JassimAlRahma-9056 asked WenyanZhang-MSFT commented

GetAsync with content

Hi,

How can I use GetAsync with passing a content like this:

 var response = await client.GetAsync("https://onesignal.com/api/v1/notifications", content);


Thanks

dotnet-csharpdotnet-xamarin
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'll assume you are referring to the HttpClient. There's no content in an HTTP GET request. Are you trying to send a POST; PostAsync???


0 Votes 0 ·

No, I am trying to GET with Parameters

0 Votes 0 ·

As AgaveJoe said, if you want to use GetAsync with parameters, you can have a try like this

 var response = await client.GetAsync("https://onesignal.com/api/v1/notifications?content="your content"&key1=value1&key2=value2");
0 Votes 0 ·

1 Answer

AgaveJoe avatar image
1 Vote"
AgaveJoe answered

HTTP GET submits parameters in the URL and does not have a body like POST. For example...

 https://onesignal.com/api/v1/notifications?id=1&msg=hello

Parameter can also exist as part of the URL. In Web API these are called route parameters and match a configured pattern.

 https://onesignal.com/api/v1/notifications/1/hello

You'll need to read the API documentation to understand how to format the URL.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.