Forum Discussion

cscooper's avatar
cscooper
Occasional Contributor
7 years ago

Can't get JSON ReviewService.addFiles to work

I'm just starting to communicate with SmartBear using JSON, and have some comands working but ReviewService.addFiles is giving me trouble.

 

I take my file, put it into a ZIP file named by its MD5 (with no extension), and send it using this form data:

 

 

--0078a65ecb044aef9c7d9caade698df6
Content-Disposition: form-data; name="json" Content-Type: application/json;charset=utf-8 [{"command":"SessionService.authenticate","args":{"login":"<snip>","ticket":"<snip>"}}, {"command":"ReviewService.addFiles","args":{"reviewId":668,"changelists":[{"zipName":"Collaborate.zip","versions":[{"md5":"E6C7A60AD81B7F0ADA3C77C156304B36","localPath":"c:\\temp\\cancel.txt","source":"LOCAL"}]}]}}] --0078a65ecb044aef9c7d9caade698df6
Content-Disposition: form-data; name="Collaborate.zip"; filename="Collaborate.zip" Content-Type: application/x-zip-compressed [925 bytes binary data] --0078a65ecb044aef9c7d9caade698df6--

 

 

I get back the error

 

   Response "[{"result":{}},{"errors":[{"code":"RequestError","message":"File paths (with supplied md5 hash) missing from content cache during ReviewService.addFiles API call: c:/temp/cancel.txt (E6C7A60AD81B7F0ADA3C77C156304B36)"}]}]"

What am I doing wrong?

 

  • I found the problem, I was sending the MD5 with upper-case characters.

  • cscooper's avatar
    cscooper
    Occasional Contributor

    I found the problem, I was sending the MD5 with upper-case characters.