Create an ACL file for a resource - Getting an error

Hi all,

I am trying to create an .acl file for a resource in CSS via http POST request. But I am getting the following error.

{"name":"ForbiddenHttpError","message":"Slug bodies that would result in an auxiliary resource are forbidden","statusCode":403,"errorCode":"H403"}

And my http request is as follows.

final createResponse = await http.post(
    Uri.parse(fileLocUrl),
    headers: <String, String>{
      'Accept': '*/*',
      'Authorization': 'DPoP $accessToken',
      'Connection': 'keep-alive',
      'Content-Type': 'text/turtle',
      'Link': '<http://www.w3.org/ns/ldp#Resource>; rel="type"',
      'Slug': 'myDataFile.ttl.acl',
      'DPoP': dPopToken,
    },
    body: '',
  );

Any idea what’s causing this error?

Thanks in advance for your support.

Anushka

I believe you’re not allowed to manually set the ACL URL. Instead, you’ll have to read the headers of the Resource you’re trying to create an ACL for, read the Link header with rel="acl", and then do a PUT with the desired ACL content to that URL to create it.

1 Like

POST is forbidden for auxiliary resources. This is due to the incertain outcome of the location of the resource.
You MUST use PUT.

1 Like

Great. Thanks a lot @Vincent and @bourgeoa. That worked perfectly.