I am curious if I can control the results of a query so that it will not display the a particular field in the query. For instance...

query:

[{
  "id": null,
  "name": null,
  "type": "/people/person"
}]

result:

{
  "result": [
    {
      "type": "/people/person",
      "id": "/en/jack_abramoff",
      "name": "Jack Abramoff"
    },
    {
      "type": "/people/person",
      "id": "/en/bob_ney",
      "name": "Bob Ney"
    },...

I have tried this...

[{
  "id": null,
  "name": null,
  "type": [{
    "id": "/people/person",
    "limit": 0
  }]
}]

Which gives me ...

{
  "result": [
    {
      "type": [],
      "id": "/en/jack_abramoff",
      "name": "Jack Abramoff"
    },
    {
      "type": [],
      "id": "/en/bob_ney",
      "name": "Bob Ney"
},...

I am wondering if there is a way to just get this

{
  "result": [
    {
      "id": "/en/jack_abramoff",
      "name": "Jack Abramoff"
    },
    {
      "id": "/en/bob_ney",
      "name": "Bob Ney"
    },...
有帮助吗?

解决方案

No, there is no way to do this. Why would you need to do this? Once you parse the JSON data in your application its very easy to just ignore any values that you don't need. The APIs support using gzip compression so you don't have to worry about the response size either. If you're really optimizing for speed you might consider switching to the Search API which looks like this:

https://www.googleapis.com/freebase/v1/search?filter=(all+type:/people/person) 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top