Message Boards Message Boards

0
|
14608 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

API - validatequery response format problems

Posted 10 years ago

Hi everyone!

I'm having a strange output from Wolfram|Alpha API and I would like to talk about it with you.

Talking about the "validatequery" method, if my query has an error, here is the output (a pseudo-json):

     WrapValidateQueryResult[{If[API`ValidateQuery`Private`mClientVersion > 0,
     $ServletRequest[API`ValidateQuery`Private`getAttribute["mErrorMessage"]], Null]["error", {},
     {If[API`ValidateQuery`Private`mClientVersion > 0,
     $ServletRequest[API`ValidateQuery`Private`getAttribute["mErrorMessage"]], Null]["code", {}, 
     {"1"}], If[API`ValidateQuery`Private`mClientVersion > 0,
     $ServletRequest[API`ValidateQuery`Private`getAttribute["mErrorMessage"]], Null]["msg", {}, 
     {"Invalid appid"}]}]}, False, True, 0.013976`4.5969278854708495, 0, ""]

If the query has no errors, I get normal XML output, as expected.

Now, I didn't read anything about this in the documentation... it is a normal thing? I think it would be more comfortable to have a single format, for more consistency! :)

Let me know if you too stumbled across this!

2 Replies

Hi Bruce, thank you for your answer. Exactly, that's the validatequery function.

As an example you can use the simple one (pi) you quoted on your reply.

http://api.wolframalpha.com/v2/validatequery?input=pi&appid=xxxxx

If I use it with a real AppId no problem: I get the XML as expected. However, if I specify a fake AppId I get that pseudo-json output. Now, this is a request with an error item (code, message) and I think it would be better to deal with it as an XML output, even if it's an error... just to be more consistent.

Let me know if you need other elements! :)

Also, I would give others suggestions about the XML output, if possible.

However, thank you for your hard work on WolframAlpha. I really love it.

Are you talking about http://products.wolframalpha.com/api/documentation.html, section "The validatequery Function",

http://api.wolframalpha.com/v2/validatequery?input=pi&appid=xxxxx 

?

Could you provide an example of an incorrect query that gives the WrapValidateQueryResult output?

POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract