problems using the get items by path API to get the GUID of file names with spaces

  • 1
  • Problem
  • Updated 3 years ago
Hi, whne trying to use the get Items ByPath API to get the GUID of a file with spaces, I get a 400 error:
java.io.IOException: Server returned HTTP response code: 400 for URL: https://remedypartnersdev.sf-api.com/sf/v3/Items/ByPath?path=/Reports/OPSSPEND/439106/2070-a53... ADDOLORATA VILLA 145724 SNFPR Q 151125.xlsx. But when I use the web tool, I get back the GUID. Can you tell me how to fix this as this is blocking our production rollout.
Photo of Bruce Wilkins

Bruce Wilkins

  • 34 Posts
  • 1 Reply Like

Posted 3 years ago

  • 1
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Software Engineer

  • 732 Posts
  • 102 Reply Likes
Bruce,

When a 400 Error happens, it means there is some issue with the way your request was constructed. You should look beyond the Http Status code and parse the response object; ShareFile will send back an error_message property that will tell you exactly what is wrong.

In this case, it looks like you need to encode the spaces on the path. That means you'll substitute each space with '%20'. Let me know if this is something you already tried and it still doesn't work. 

Best,
Eli
Photo of Bruce Wilkins

Bruce Wilkins

  • 34 Posts
  • 1 Reply Like
replacing the spaces with &20 worked. Thank you for the prompt response.