ASP.NET Web API发布到外部API
我想问一个创建的ASP.NET Web API(用C#编写)发布到外部API是否可以?
如果可能的话,请共享可以通过添加标头发布到URL并从外部API接收回调的示例代码。
I would like to ask if it is possible for a created ASP.NET Web API (written in C#) to post to an external API?
If it is possible, please share sample code that can post to an url with adding headers and receive a callback from the external API.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从.net-application中使http-request的一种简单方法是
system.net.http.httpclient
( msdn )。一个示例用法看起来像这样:A simple way to make HTTP-Request out of a .NET-Application is the
System.Net.Http.HttpClient
(MSDN). An example usage would look something like this:本质上,您需要使用
httpclient
的实例将httprequestMessage
发送到端点。这是一个将一些
jsondata
发布到someendPointUrl
的示例:Essentially you need use an instance of
HttpClient
to send anHttpRequestMessage
to an endpoint.Here is an example to post some
jsonData
tosomeEndPointUrl
: