I am trying out GPTZero's API. The docs.
The documentation says I need to set the api key in the header. I have left it as a blank string as the website says I "…can try out the API right here in the docs without an API-key for a limited number of uses."
I believe I have set document and version params correctly.
Here is my Ruby:
base = "https://api.gptzero.me"
uri = URI("#{base}/v2/predict/text")
api_key = ""
headers = {
"x-api-key" => api_key
}
params = {
"document" => "How now, brown cow.",
"version" => ""
}
res = Net::HTTP.post(uri, params.to_json, headers)
However the response is 400 Bad Request with the error message: "Text must be a string".
What is wrong with my request? Have I sent it correctly?
Looks like you are missing the
Content-Typeheader. This example works for me:It prints