RestCharp를 사용하여 MailChimp 계정의 계정 세부 정보를 쿼리 할 때 "API 키가 누락되었습니다."라는 메시지가 나타나면 "401 : unauthorized" 그것은 분명히 아닙니다!RestCharp를 사용하여 Mailchimp API 3.0에 계정 세부 정보를 쿼리 할 때 "API 키가 없습니다."오류가 발생합니다.
우리는 여러 가지 다른 방법으로 RestClient를 만드는 데 같은 방법을 사용하고 있으며 모든 요청에서 완벽하게 작동합니다. 그러나 RestRequest URI가 비어 있음을 의미하는 계정 세부 정보를 요청할 때이 이상한 오류 및 메시지가 표시됩니다.
예 :
private static RestClient CreateApi3Client(string apikey)
{
var client = new RestClient("https://us2.api.mailchimp.com/3.0");
client.Authenticator = new HttpBasicAuthenticator(null, apiKey);
return client;
}
public void TestCases() {
var client = CreateApi3Client(_account.MailChimpApiKey);
var req1 = new RestRequest($"lists/{_account.MailChimpList}/webhooks", Method.GET);
var res1 = client.Execute(req1); // works perfectly
var req2 = new RestRequest($"automations/{account.MailChimpTriggerEmail}/emails", Method.GET);
var res2 = client.Execute(req2); // no problem
var req3 = new RestRequest(Method.GET);
var res3 = client.Execute(req3); // will give 401, api key missing
var req4 = new RestRequest(string.Empty, Method.GET);
var res4 = client.Execute(req4); // same here, 401
}
모두가 잘 우체부의 API 호출을 시도. https://us2.api.mailchimp.com/3.0
, 기본 인증을 가진 GET은 모든 계정 정보를 제공하고 C#으로 디버깅 할 때 모두 동일하게 보입니다.
RestSharp 또는 MailChimp API에서 버그를 지적할지 여부를 결정하려고합니다. 비슷한 문제가있는 사람이 있습니까?