AnsweredAssumed Answered

CCU V3 Purge for c# and EdgeGrid

Question asked by Ryan McCarty on Nov 21, 2017
Latest reply on Nov 27, 2017 by Ryan McCarty

I am working on developing a webapp in asp.net c# for uploading single files and file directories using Akamai's API.  In the same app I'm also trying to get the purge aspect working as well, and so I've come to find out that this action has been updated to a new version.  With this new version I'm guessing the older ones won't work anymore right? Also I'm not exactly sure what the EdgeGrid is supposed to be, is it used with the new version of CCU?

How exactly would I go about using CCU v3 in my application? I know there is documentation but it isn't very clear on what to do exactly imo.

 

This is the old version I was trying to get to work, every time I tried however I get a status code 301

protected void CCURefresh()
{

PurgeApi purge = new PurgeApi();
string strImagepath = textinput.Text;
string network = "";
string[] options = new string[3];
options[0] = "action=remove"; // remove or invalidate
options[1] = "type=arl"; // arl or cpcode
options[2] = "domain=production"; // production or staging
string strURI = textinput.Text;
// Configure URI array:
string[] uri = new string[1];
uri[0] = strURI;

try
{
//Line to Purge an image from Akamai
PurgeResult result = purge.purgeRequest(ccuser, password, network, options, uri);
if(Response.StatusCode == 200)
{
Response.Write("Result code: "+result.resultCode+"| Result message: " + result.resultMsg +"| Session Id: "+ result.sessionID+"| Estimated time: " + result.estTime +"| URI index: "+ result.uriIndex);
foreach (string x in uri)
{
messagestatus.Text = x.ToString() + " - was purged";
}
}
}
catch(Exception d)
{
messagestatus.Text = "An error was found: " + d.ToString();
}
}

Outcomes