Loading a BoxFile Object
回答済みHi,
I am doing a search through Box API looking for files with particular "file name". The search is giving me back the details of the file as a JSon element. The question is how can i load a BoxFile object using that Json element? I need to load that BoxFile object and do some changes to its shared link.
Note: Medium is Java.
Any help is appreciated.
Regards,
Magesh Kumar.
-
Hello my friend,
You should do more research on your own, read the API documentation before you post questions.
Any way, file object is just for file. To update shared link you should use shared link API:
for instance:
curl https://api.box.com/2.0/files/FILE_ID?fields=shared_link \ -H "Authorization: Bearer ACCESS_TOKEN" \ -d '{"shared_link": {"access": "open", "password" : "topsecretdoc"}}' \ -X PUT
use the FILE_ID that you obtained from the file object.
For more see this link:
https://developer.box.com/v2.0/reference#get-shared-link
Hope this helps.
thanks,
Bibek
-
Hi Magesh,
I do not use Java language but it doesn't matter which language you use.
To update the expiration date you should use:
curl https://api.box.com/2.0/files/1234?fields=shared_link \ -H "Authorization: Bearer ACCESS_TOKEN" \ -d '{"shared_link": {"unshared_at":"2017-05-30"}}' \ -X PUT
This e.g. updates shared link for file id 1234 to May 30 of 2017.
You only need to convert this to Java. Not sure how you are using it (either via plain Java or using Box SDK). But it's pretty much staright forward to do this.
thanks,
Bibek
サインインしてコメントを残してください。
コメント
4件のコメント