Got "Bad Request" as parent is required using API Call in API Reference.
Hi,
I want to try using the API Call in this website API reference for creating new folder
but instead I got the Bad Request saying that parameter is missing due to parent is required.
In developer mode, the console keep showing that
Is there anyway I can successfully do the API call via the API site ?
-
Click to expandHi - You likely tried to create a folder without specifying a parent folder id. If you want to create a folder in your 'root' - i.e. the view you see when you first log in, you use id = 0. For example:
curl --location --request POST 'https://api.box.com/2.0/folders' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer mytoken' \ --data-raw '{ "name": "A New Folder", "parent": { "id": "0" } }'
I suggest you check out the Postman collection as it has many examples of properly formatted API calls
https://developer.box.com/guides/tooling/postman/ -
Hey - It looks like this may be a problem with our documentation site. I was able to reproduce the same error and it looks like the browser is not actually sending the parent folder id when it sends the API request. I've logged a request with our developer relations team to look into this, but in the mean time I suggest you use our Postman collection to experiment with the API.
Please sign in to leave a comment.
Comments
3 comments