Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DllExport class
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01643554
Message ID:
01643627
Views:
28
Viv,

Do you know a good example of using HttpClient ? I found this link

https://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client

but it does not recognize PostAsJsonAsync when I try to use that code.

UPDATE. Found this http://stackoverflow.com/questions/19158378/httpclient-not-supporting-postasjsonasync-method-c-sharp so I am going to add an extension as that thread suggests.

Also, I'm not clear how to set the properties I need.

The sample call which I need to use is the following:
POST /integrationapi//Attraction/Tickets/Validate HTTP/1.1
Host: hostsitehere
Content-Type: application/json
Authorization: Basic encodedstringhere
Cache-Control: no-cache
Postman-Token: encodedstringhere
 
{
  "TicketUsageRequests": [
    {
      "TicketBarcode": barcodehere",
      "TicketUsageDate": "2016-10-28T15:09:06.7021957-06:00",
      "UserID": "userNameHere"
}
  ]
}
Thanks a lot in advance.

I also found how to set Authorization. I'm not sure about Cache-Control and Postman-Token. Also, my function is going to pass number of tries. What exactly would it mean in terms of programmin.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform