3

Following the Freebase docs on Envelope Parameters, running

{
  "cursor":true,
  "query":[{
    "type":"/music/album",
    "artist":"The Police",
    "name":null,
    "limit":10
  }]
}​

results in error "Key cursor is a reserved word" as @Domenic notes.

What's going wrong?


Edit 1

So this query without a cursor works but this one doesn't because cursor was a variable name not a string enclosed in quotes.

As a user it makes sense to type the broken version of "cursor" because the read parameter type table has both query and "cursor" as type: string, and query errors out if your enclose it in quotes as "query"

However, even enclosing "cursor" in quotes still doesn't work: it results in the same data for every query.

Community
  • 1
  • 1
Alec Wenzowski
  • 3,878
  • 3
  • 25
  • 40
  • The link that you gave leads to a working version of this query in the query editor. Did you get this error in the query editor or by calling the APIO directly? – Shawn Simister Nov 04 '11 at 16:17
  • Both with the exact same query, neither was working at time of posting. Good to know the docs are correct, and that it's working now. If it happens again I'll take a screenshot. – Alec Wenzowski Nov 04 '11 at 16:31
  • Re: Edit 1 - the first request should just be mqlread?cursor=&query=[{...}]. That will return a query value in the results and then your next request would look something like mqlread?cursor=eNo10UlqAzEQBdALCVxz1e...&query=[{...}] – Shawn Simister Nov 04 '11 at 19:35

1 Answers1

1

It looks like this may be another case of the query editor being too smart and fixing things for us. If you copy and paste the query above into the query editor and press Run you will get this error as you reported:

{
  "code":          "/api/status/error",
      "messages": [{
    "code":    "/api/status/error/mql/type",
    "info": {
      "expected_type": "/type/object",
      "property":      "cursor"
    },
    "message": "Key cursor is a reserved word",
    "path":    "",
    "query": {
      "cursor":       true,
      "error_inside": ".",
      "query": [{
        "artist": "The Police",
        "limit":  10,
        "name":   null,
        "type":   "/music/album"
      }]
    }
  }],
  "status":        "200 OK",
  "transaction_id": "cache;cache03.p01.sjc1:8101;2011-11-04T17:42:13Z;0057"
}

But then if you click on the permalink to that query it changes it to this query and automatically sets the cursor property to true.

[{
  "type":   "/music/album",
  "artist": "The Police",
  "name":   null,
  "limit":  10
}]​

This happens because the MQL read service expects a query to be nested inside a query envelope but the query editor just takes the query you give it and automatically wraps it in an appropriate query envelope for you.

In the new version of the MQL read service, we've done away with the query envelope and now cursor is just a parameter on the HTTP GET request.

Shawn Simister
  • 4,613
  • 1
  • 26
  • 31