Find Item from Shared Link
Find Item from Shared Link
The find item for shared link API is designed to
accept a shared link as an input using a BoxApi
header and return the file or
folder object that the shared link is set for.
To get the file or folder object associated with a shared link, supply the full shared link URL in the request.
cURL
curl -i -X GET "https://api.box.com/2.0/shared_items" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "boxapi: shared_link=https://app.box.com/s/gjasdasjhasd&shared_link_password=letmein"
TypeScript Gen
await userClient.sharedLinksFiles.findFileForSharedLink(
{} satisfies FindFileForSharedLinkQueryParams,
{
boxapi: ''.concat(
'shared_link=',
fileFromApi.sharedLink!.url,
'&shared_link_password=incorrectPassword',
) as string,
} satisfies FindFileForSharedLinkHeadersInput,
);
Python Gen
user_client.shared_links_files.find_file_for_shared_link(
"".join(
[
"shared_link=",
file_from_api.shared_link.url,
"&shared_link_password=incorrectPassword",
]
)
)
.NET Gen
await userClient.SharedLinksFiles.FindFileForSharedLinkAsync(queryParams: new FindFileForSharedLinkQueryParams(), headers: new FindFileForSharedLinkHeaders(boxapi: string.Concat("shared_link=", NullableUtils.Unwrap(fileFromApi.SharedLink).Url, "&shared_link_password=incorrectPassword")));
Swift Gen (Beta)
try await userClient.sharedLinksFiles.findFileForSharedLink(queryParams: FindFileForSharedLinkQueryParams(), headers: FindFileForSharedLinkHeaders(boxapi: "\("shared_link=")\(fileFromApi.sharedLink!.url)\("&shared_link_password=incorrectPassword")"))
Java
String sharedLink = "https://app.box.com/s/abcdefghijklmnopqrstuvwxyz123456";
String password = "foo";
BoxItem.Info itemInfo = BoxItem.getSharedItem(api, sharedLink, password);
Python
file = client.get_shared_item('https://app.box.com/s/gjasdasjhasd', password='letmein')
Node
client.sharedItems.get(
'https://app.box.com/s/1a2b3c4d5e',
null,
{fields: 'type,id,parent,extension,shared_link'},
callback
);
iOS
client.sharedItems.get(
sharedLinkURL: "https://app.box.com/s/qqwertyuiopasdfghjklzxcvbnm123456"
) { (result: Result<SharedItem, BoxSDKError>) in
guard case let .success(item) = result else {
print("Error resolving shared item")
return
}
print("The shared link resolves to item:")
switch item {
case let .file(file):
print("- File \(file.name) (ID: \(file.id))")
case let .folder(folder):
print("- Folder \(file.name) (ID: \(file.id))")
case let .webLink(webLink):
print("- Web Link \(file.name) (ID: \(file.id))")
}
}