【发布时间】:2021-08-09 18:33:57
【问题描述】:
这是我第一次使用 RestSharp
我正在尝试使用他们的 FormsAPI (https://legacydocs.hubspot.com/docs/methods/forms/submit_form) 连接到 HubSpot
使用 .Net、C#、MVC。
当我在 Fiddler 中运行时,它可以工作。
这是我的 C# 代码,当我运行它时,我得到一个“未找到”的状态代码。我确定这很简单吗?
var client = new RestClient("https://api.hsforms.com");
var request = new RestRequest("submissions/v3/integration/submit/{PortalId}/{formGuid}", Method.POST);
request.AddUrlSegment("portalId", "[myportalid]");
request.AddUrlSegment("formGuid", "[myformid]");
request.AddQueryParameter("hapikey", "[myapikey]");
request.RequestFormat = DataFormat.Json;
request.AddParameter("firstname", "testfirstname");
request.AddParameter("lastname", "testlastname");
request.AddParameter("email", "testemail@emailaddress.com");
request.AddParameter("business_unit", "Test");
【问题讨论】:
标签: json asp.net-mvc restsharp