POST method
Can you give an example of using POST method? The manual says POST method is recommended, but "q" parameter is still mandatory. I tried to send my text as POST and get an empty list of detections.
-
AdminLaurynas (Admin, Detect Language) commented
Hi,
you should use form encoded POST body to pass API key and q:
http://en.wikipedia.org/wiki/POST_(HTTP)#Use_for_submitting_web_formsIf you are using Ruby, Java or PHP, I recommend to use at one of the clients:
https://github.com/detectlanguage/If you prefer not to use the official client, here is an example with Ruby:
require 'net/http'
uri = URI.parse('http://ws.detectlanguage.com/0.2/detect')
response = Net::HTTP.post_form(uri, key: 'demo', q: 'my text')
puts response.body