Creating a shared link always returns insuffecient privledges
I'm working an a tool in php to mirror some content on our server into Box. So far I've been able to traverse the document structure and create folders and upload files. It's been a bit of trial and error, but it's been going more or less smooth.
The last step is generating a few shared links to different directories. I created this function, but every time I run it, I get a return error of insufficient privileges. I don't really understand this because the prior action taken was creating the folder. The token doesn't change.
Here's the code. I've replaced some of the obvious things. I've been able to verify that the id is being generated correctly and sent. this is in fact for a folder as the code would suggest too.
global $token; $sharedLink = array(); $sharedLink['access'] = 'open'; $sharedLink['password'] = 'topsecret'; $params = array(); $params['shared_link'] = $sharedLink; $params = json_encode($params); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.box.com/2.0/folders/".$id."?fields=shared_link"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '.$token)); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); $result = curl_exec($ch); $result2 = json_decode($result, true); curl_close($ch);
I'm not sure what's causing the permission error or if I've just got my request structured incorrectly. If anyone can offer any guidance, I'd definitely appreciate it!
サインインしてコメントを残してください。
コメント
0件のコメント