Skip to main content

Hello to you all



I am quite new to Box (coming from pCloud, with reliability issues)



I have an issues when creating folder shared links with an API call.


I do receive a folder shared_link.url, but no shared_link.download_url


(I have the link that displays the content of the shared folder, I look for the link that would download the archive of the shared folder)


In the JSON returned by the BOX API, at the shared_link.download_url variable, I am receiving a ‘null’ value. In the API documentation, an URL is received.



If you have an idea about this, would you be so kind as to share it with me ?



Kind regards,



Pierre






I place the following call


(PUT) https://api.box.com/2.0/folders/XXXXXXX?fields=shared_link



Body:



{

"shared_link": {

"access": "open",

"password": null,

"unshared_at": "2024-06-05T08:03:38",

"permissions": {

"can_download": true,

"can_edit": false

}

}

}



The answer I receive:



HTTP/1.1 200 OK

Transfer-Encoding: chunked

x-envoy-upstream-service-time: 308

box-request-id: XXXXXXX

strict-transport-security: max-age=31536000

Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

Connection: close

Cache-Control: no-cache, no-store

Content-Type: application/json

Date: Mon, 06 May 2024 06:03:39 GMT

ETag: "0"

Via: 1.1 google



{

"type": "folder",

"id": "262171966836",

"etag": "0",

"shared_link": {

"url": "https://XXXXXXXXX.XXXXXXX.",

"download_url": null,

"vanity_url": null,

"vanity_name": null,

"effective_access": "open",

"effective_permission": "can_download",

"is_password_enabled": false,

"unshared_at": "2024-06-05T08:03:38-07:00",

"download_count": 0,

"preview_count": 0,

"access": "open",

"permissions": {

"can_preview": true,

"can_download": true,

"can_edit": false

}

}

}

Hi @hyperalpha , welcome to the forum!



I edited you post format to be easier to read.



This is the expected behavior of the shared links for folders, you can have a download URL for a file but not for a folder. You can look at our guide, however I did notice that our API documentation for the response of the folder shared link does include a download URL for a file, which is incorrect, and inconsistent.



To download a folder you will need the ZIP download, and its use depends a lot on your use case, since you have to first ping the API to create the zip, then you receive a download URL.



Let us know a bit more about your use case.



Cheers


Reply