PI WebAPI remove cache instance for a user fails.

Hi,

 

I would like to remove a PI WebAPI cache instance for a user from C# code but it fails.

I know the implications, you should not do this on a regular basis, but I still want to be able to do it.

When I look at the available documentation here:

https://docs.aveva.com/bundle/pi-web-api-reference/page/help/controllers/system/actions/removecacheinstance.html

and here:

https://docs.aveva.com/bundle/pi-web-api/page/1220618.html

I should do a DELETE request to the PI WebAPI with the SID of the user.

So I suppose my C# code would look like this (simplified):

 

  using var client = new HttpClient();

string url = "https://mypiweb/piwebapi/system/cacheinstance?userId='S-1-5-21-255235235-2613889227-2915372978-123456'";

  HttpResponseMessage response = await client.DeleteAsync(url);

 

I also tried :

var downloadRequest = new HttpRequestMessage();

 downloadRequest.Method = new HttpMethod("DELETE");

 downloadRequest.RequestUri = new Uri(url, UriKind.RelativeOrAbsolute);

 var downloadResponse = await httpClient.SendAsync(downloadRequest);

 

In both cases I get the 404 error, The cache instance was not found for the specified user id.

 

I copy the SID from the overview: https://mypiweb/piwebapi/system/cacheinstances

 

I am a PI Admin and use Kerberos or Basic authentication.

 

What am I missing? Should i do something somewhere? Some config change?

 

Any help appreciated.