Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added /postvalidate route for JSON POST validation #25

Merged
merged 2 commits into from
Aug 9, 2016
Merged

added /postvalidate route for JSON POST validation #25

merged 2 commits into from
Aug 9, 2016

Conversation

calvinbutcher
Copy link
Contributor

New "/postvalidate" route receives POST of JSON body-text with a Content-Type:application/json. Responds with JSON returning the received data, an okay flag, warnings, and errors.

@@ -113,7 +136,8 @@ def do_test(self):
return self.format_response(infojson, fmt)

def dispatch_views(self):
self.app.route("/validate", "GET", self.do_test)
self.app.route("/validate", "GET", self.do_GET_test)
self.app.route("/postvalidate", "POST", self.do_POST_test)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just POSTing to /validate ? No need to introduce a new URI?

Copy link
Contributor Author

@calvinbutcher calvinbutcher Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, understood.

@azaroth42 azaroth42 merged commit cb571e5 into IIIF:master Aug 9, 2016
@azaroth42
Copy link
Member

Merged, thanks @calvinbutcher!

@schwemmer
Copy link

Thanks, @calvinbutcher, this is very useful! I have a couple of issues/questions about this:

  1. when POSTing to http://iiif.io/api/presentation/validator/service/validate I get the following error: XMLHttpRequest cannot load http://iiif.io/api/presentation/validator/service/validate. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 405.
  2. I assume the POST parameter name for the data to validate is data, correct?
  3. Is it possible to specify the API version with a version parameter?

@azaroth42
Copy link
Member

1 would be because the new code isn't deployed yet :)

I expect that 2 is that the JSON is in the body of the POST, rather than web form encoded.

@schwemmer
Copy link

Thanks, Rob! Please let me know when it's deployed by commenting here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants