简体   繁体   English

如何在C#(VS)中作为REST-API客户端发出GET / POST HTTPS请求

[英]How to make a GET/POST HTTPS request as a REST-API client in c# (vs)

I used this guide: https://www.codeproject.com/Tips/497123/How-to-make-REST-requests-with-Csharp in order to perform a simple HTTP request. 我使用了本指南: https : //www.codeproject.com/Tips/497123/How-to-make-REST-requests-with-Csharp ,以便执行简单的HTTP请求。 What should I change in order to make an HTTPS request? 为了发出HTTPS请求,我应该更改什么?

I don't think you need to use five years old samples for such things. 我认为您不需要使用已有五年历史的样本进行此类操作。 There are many libraries that support easy REST API calls, one of the most popular is RestSharper . 有许多库支持简单的REST API调用,其中最受欢迎的库之一是RestSharper However, it has no changes since last year, seems having issues with maintainers. 但是,自去年以来,它没有发生任何变化,似乎与维护人员存在问题。 However it is still moer usable and supports async/await . 但是,它仍然不可用,并支持async/await

To make a call via SSL all you need to do is indeed use https:// in the URL as @Crowcoder suggest in the comment. 要通过SSL进行呼叫,您实际上要做的就是在URL中使用https:// ,如@Crowcoder在注释中建议的那样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM