how to get link using sharedLinkCreateRequestForFile
I am trying to create shared link but it is giving error
func publicUrl(for item: CloudItem, completion: @escaping(String?) -> Void){
let client = BOXContentClient.default()
let request = client?.sharedLinkCreateRequestForFile(withID: item.id)
request?.accessLevel = BOXSharedLinkAccessLevelOpen
request?.expirationDate = Date(timeInterval: 3600, since: Date())
request?.canDownload = false
request?.canPreview = true
request?.perform(completion: { (file, error) in
completion(file?.sharedLink.url.absoluteString)
print(file?.sharedLink.url.absoluteString)
print(item.id)
print(error)
})
}
getting error
Optional(Error Domain=com.box.contentsdk.errordomain Code=403 "(null)" UserInfo={com.box.contentsdk.jsonerrorresponse={
code = forbidden;
"context_info" = {
errors = (
{
message = "Invalid value '***number removed for privacy***0'. Shared link expiration can only be set on items owned by paid users.";
name = "unshared_at";
reason = "invalid_parameter";
}
);
};
"help_url" = "http://developers.box.com/docs/#errors";
message = Forbidden;
"request_id" = pynodyfqj6vht7t0;
status = 403;
type = error;
}})
what about free users?
-
Hi ,
Thanks for your post. I know you mentioned you created a shared link but I see the error, "Shared link expiration can only be set on items owned by paid users."
Shared link expiration is only available for business users and not free users; if you remove that expiration field from your shared link, do you still experience an error?
サインインしてコメントを残してください。
コメント
1件のコメント