Closed ryanpete-dominion closed 7 years ago
The error suggests that either compareSettings
or the mask
value is not set correctly. Just checked the code, this validation is pretty lenient (it doesn't check for values specifically), so it might be that mask value is not passed at all.
Looking at the request snippet, it seems that your form post body is malformed. VisualReview's image upload API works as if you're posting a form. So passing a mask
value should look something like this:
mask=%7B%22mask%22%3A%7B%22excludeZones%22%3A%5B%7B%22height%22%3A333%2C%22x%22%3A8%2C%22width%22%3A214%2C%22y%22%3A15%7D%5D%7D%7D
It seems gibberish, but that's just because of all the url encoding of the JSON value.
this is what I see in fiddler when looking at the request. I'm including one of the form parts that I can confirm is working as I was using that as the keystone for building out the next part I wanted to add (masking).
--2416c1f8-a45b-4e89-a865-bfce5a47d03a [confirmed working] Content-Type: text/plain Content-Disposition: form-data; name=screenshotName
WidgetStructure --2416c1f8-a45b-4e89-a865-bfce5a47d03a Content-Type: application/json Content-Disposition: form-data; name=mask
{"mask":{"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]}} --2416c1f8-a45b-4e89-a865-bfce5a47d03a--
I've tried a few other options on specifying the value and outlined the results below
- {"mask":{"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]}} [422 - Validation :com.xebia.visualreview.validation/screenshot-mask failed]
- mask={"mask":{"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]}} [500 - Internal error occurred]
- {"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]} [500 - Internal error occurred]
I think the confirmed-working request worked because its request body follows the key=value
structure. This should mean that the second of the other-option list should work as well. However, you might have to escape the mask value using url encoding.
the request should look something like this: (note I'm using content-type application/plain) Content-Type: application/plain Content-Disposition: form-data; mask=%7B%22mask%22%3A%7B%22excludeZones%22%3A%5B%7B%22height%22%3A333%2C%22x%22%3A8%2C%22width%22%3A214%2C%22y%22%3A15%7D%5D%7D%7D
For the total request to work however, you'll need to add a screenshot name, binary data, meta and properties field as well.
Thanks for your help. I'm clear of the error after making a few adjustments
--2416c1f8-a45b-4e89-a865-bfce5a47d03a Content-Type: application/plain [previous=application/json] Content-Disposition: form-data; [removed]name=mask [added]mask={"mask":{"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]}} --2416c1f8-a45b-4e89-a865-bfce5a47d03a--
Couple of additional notes here
@skwakman @ryanpete-dominion I failed to get it to work. Could you please explain how to do it in Postman?
I solved a problem. It has to be:
Content-Type: application/json
Content-Disposition: form-data; name=mask
{"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]}
Note, there is no "mask":
in json body.
Previous answers don't help me. Please, fix documentation.
I am encountering the following error when attempting to upload a screenshot with "masks" defined on the request.
Error message
Validation :com.xebia.visualreview.validation/screenshot-mask failed
Request snippet
Content-Type: application/json
Content-Disposition: form-data; name=mask
{"mask":{"excludeZones":[{"height":333,"x":8,"width":214,"y":15}]}}