"Missing path field" error during folder`s children iteration
Hi,
Lately we began encountering following error:
The API returned an error code {"type":"error","status":400,"code":"bad_request", "context_info":{"errors":[{"reason":"missing_parameter","name":"path","message":"'path' is required"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Bad Request","request_id":"l04abhfy9y9s3fs9"}
this happens in a for-each iteration over folder`s children.
the code fragment looks like this (in JAVA code 😞
.. private static String[] FOLDER_INFO_PROPERTIES_RETRIEVE = {"type", "id", "sequence_id", "etag", "name", "created_at", "modified_at","size", "path_collection", "created_by", "modified_by", "content_created_at", "content_modified_at", "owned_by", "shared_link", "parent", "item_status", "item_collection", "permissions"}; ... public void crawl(){ BoxFolder folder = new BoxFolder(getApi(), folderId); Iterable folderChildren = folder.getChildren(FOLDER_INFO_PROPERTIES_RETRIEVE)); for (BoxItem.Info itemInfo : folderChildren) { logger.trace("discovered item: "+ itemInfo.getName()); if(itemInfo instanceof BoxFile.Info){ ... }
This code worked perfectly and still works for other folders, but this particular ends with an error.
I debugged into the BOX API code and found the REST GET request generated:
https://api.box.com/2.0/folders/#5***phone number removed for privacy***/items/?fields=type%2Cid%2Csequence_id%2Cetag%2Cname%2Ccreated_at%2Cmodified_at%2Csize%2Cpath_collection%2Ccreated_by%2Cmodified_by%2Ccontent_created_at%2Ccontent_modified_at%2Cowned_by%2Cshared_link%2Cparent%2Citem_status%2Citem_collection%2Cpermissions?limit=1000&offset=0
It has a weird structure by having two "?" query separators :
https://api.box.com/2.0/folders/#5***phone number removed for privacy***/items/?..some params...?..some more params..
Not sure what is going on.
Any help will be appreciated.
thanks
-
This looks like you are putting a phone number where a folder id is expected, and therefore likely looks like a bug in your code. Can you post an extended snippet here of your code? Where do the folders come from. Do you have test cases for your queries?
The actual api url should look like this: `
https://api.box.com/2.0/folders/
# is invalid but I am not sure if this has been added by masking the id. It is definitely not a phone number.
-
wrote:This looks like you are putting a phone number where a folder id is expected, and therefore likely looks like a bug in your code. Can you post an extended snippet here of your code? Where do the folders come from. Do you have test cases for your queries?
The actual api url should look like this: `
https://api.box.com/2.0/folders/
# is invalid but I am not sure if this has been added by masking the id. It is definitely not a phone number.
Sadly, you are wrong.
The "phone number" is inserted by the forum`s software when it recognizes the numeric string. like this this:
turns to this
https://api.box.com/2.0/folders/#5***phone number removed for privacy***/items/
So, still the original question is valid.
Any thoughts?
Thanks.
サインインしてコメントを残してください。
コメント
3件のコメント