In short - the issue appears to be that I can access a folder or file's anonymous link - but only after it's been created. When I say created - I mean clicking the 'copy link' button as show in the screen. (Also works fine if a Flow creates it)
If that's been done, then using the REST API to get the anonymous link works fine:
If I try and 'create' a link for a new file though;
So where are my permissions failing me? You may have noticed that I don't pass the X-RequestDigest. That's because it doesn't seem to do anything. Without it I can upload and do whatever I need - with it, I gain no new permissions.
The app that I'm using to authenticate against has what I think is full control over the SharePoint site. As seen in this page's example:
Is there anything I'm missing? Why wouldn't I be able to create an anonymous link through the API but I can access it if someone else has already created it?
Thanks for your time.