Akamai删除文件不起作用

时间:2018-05-19 07:04:45

标签: c# rest api cdn akamai

我正在尝试从Akamai进行新的快速清除以删除CDN中的文件,下面是我的代码,但由于某些原因它无法正常工作

代码:

[1,10, 13,26,32,36,9]

回应机构:

string client_token = PurgeAuthorization.CLIENT_TOKEN,
       access_token = PurgeAuthorization.ACCESS_TOKEN,
       secret = PurgeAuthorization.SECRET,
       api_url = PurgeAuthorization.API_URL;

ClientCredential credentials = new ClientCredential(client_token, access_token, secret);
Uri uri = new Uri(api_url + PurgeAuthorization.DELETE_ENDPOINT);
EdgeGridV1Signer signer = new EdgeGridV1Signer(null, 100000);

WebRequest request = WebRequest.Create(uri);
request.Method = "POST";
request.ContentType = "application/json";
ServicePointManager.Expect100Continue = false;

// Signs the current request using the Akamai C# library. Creates an Authentication header for the request.
request = signer.Sign(request, credentials, null);

byte[] byteArray = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(deleteObject));
Stream newStream = request.GetRequestStream();
newStream.Write(byteArray, 0, byteArray.Length);
newStream.Close();

var response = request.GetResponse();
var stream = response.GetResponseStream();
var sr = new StreamReader(stream);
var content = sr.ReadToEnd();

相同的代码用于清除有效的文件但删除失败,因此我可以确认身份验证凭据是否正常。

看起来打电话有问题,有人可以找出问题并帮助我

0 个答案:

没有答案