Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DllExport class
Message
 
 
À
17/11/2016 02:34:59
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01643554
Message ID:
01643627
Vues:
29
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform