2

RestSharp を使用して Mailchimp にキャンペーンを投稿すると、API キーが見つからないというメッセージが表示されますが、[キャンペーンを取得] をクリックすると、すべてのキャンペーン データが正常に表示されます。

誰が私が間違っているのか教えてもらえますか? これが私のコードです:

public MailChimpPostModel PostCampaign(MailChimpPostModel post)
{
    var auth = _userBusinessObject.GetUserWebsiteAuthorizationByWebsite(_userId, 
                                                                   _websiteId,
                                                                   _linkvanaNetworkSiteId);
    ApiBaseUrl = <url> ;
    if (auth == null)
        throw new RestRequestResponseException { Error = RestErrorsEnum.NotAuthenticated };

    var request = new RestRequest(3.0/campaigns, Method.POST);
    request.AddParameter("access_token", <Token>);
    request.AddParameter("apikey", <Token> + "-" + <dc>);
    request.AddHeader("content-type", "application/json");
    request.AddBody(post);
    var response = Execute<MailChimpPostModel>(request);
    return response;
}
4

1 に答える 1

2
// replace usX to match the last 3 of your API
var client = new RestClient("https://usX.api.mailchimp.com/3.0/");
client.Authenticator = new HttpBasicAuthenticator("user", APIKey);
于 2016-04-23T20:16:35.077 に答える