Closed jcreem1 closed 2 years ago
Hello @jcreem1,
Please check the URL you want to call:
https://developer.box.com/reference/get-folders-id/
This is the correct URL
print(client.make_request('GET',client.get_url('folders/0')).json());
when I try to do a call:
client.make_request('GET',client.get_url('folder/0')
I'm getting:
Status: 404
Code: not_found
Request ID: some-request-id
Headers: {'Date': 'Tue, 14 Jun 2022 06:35:37 GMT', 'Content-Type': 'application/json' ... }
URL: https://api.box.com/2.0/folder/0
Method: GET
Context Info: None
Still I think you could try and use SDK client to get folder information: https://github.com/box/box-python-sdk/blob/main/docs/usage/folders.md#get-information-about-a-folder
Please also note, the easy way to do this client.folder('0').get()
. The SDK will take care to get the correct URL.
If you do need to use make_request
for some reason, you could still get the SDK to generate the correct URL using client.make_request(client.folder('0').get_url())
Hi all ,
Thanks again for your responses. Turns out the original problem I was having stemmed from the fact that I needed to invite the Box Service Account as a collaborator in the folder. Similar to the issue discussed in the following post.
If needed, instructions on how to locate the Service Account can be found here:
https://developer.box.com/guides/getting-started/user-types/service-account/
Prior to finding this solution, I changed the BASE_API_URL variable to my company's domain, therefore, when I ran make_request() the URL returned a working link to my web app, and I think triggered the status code 200.
Thanks again
I ran the following make_request() function to list the contents of a folder:
json_response = client.make_request('GET', client.get_url('folder/[folder_id') ,).json()
However, it fails and the following exception is displayed:
BoxAPIException: Message: Non-json response received, while expecting json response. Status: 200 Code: None Request ID: None
As expected the URL that prints out takes me directly to my Box folder.
Any idea what this BoxAPIException message is supposed to convey? I add .json() to the make_request like it says in the README file on github. I think the request goes through since the return status is 200.
Thanks