Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Got "Bad Request" as parent is required using API Call in API Reference.

New post

Comments

3 comments

  • dandennhardt
    Click to expand
    Hi   - 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/

    0
    Comment actions Permalink
  • Y-Sano

    Thank you for your answer. I did try setting root folder id already but it's still kept showing the 400.

     

    無題.png

     

     

     

    無題2.png

     

     

    0
    Comment actions Permalink
  • dandennhardt

    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.

     

    https://developer.box.com/guides/tooling/postman/

    0
    Comment actions Permalink

Please sign in to leave a comment.