HERE JSON响应中的可选参数

时间:2016-02-16 10:41:50

标签: here-api

如何在JSON响应中指定我想要其他可选字段?

例如:http://places.cit.cc.api.here.com/places/v1/discover/search?&q=bengans&at=57.729,11.855;cgen=gps;u=200&app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg&pretty=true&accept=application/json

收率:

{
  "results":{
    "items":[{
      "position":[57.69909,11.93378],
      "distance":5757,
      "title":"Bengans",
      "averageRating":0.0,
      "category":{
        "id":"shop",
        "title":"Store",
        "href":"http://places.cit.cc.api.here.com/places/v1/categories/places/shop?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg",
        "type":"urn:nlp-types:category",
        "system":"places"
      },
      "icon":"http://download.st.vcdn.nokia.com/p/d/places2_stg/icons/categories/09.icon",
      "vicinity":"Stigbergstorget 1<br/>SE-414 63 Majorna",
      "having":[],
      "type":"urn:nlp-types:place",
      "href":"http://places.cit.cc.api.here.com/places/v1/places/752u622p-9ee8111dafc44ed7ad131df75599f7da;context=Zmxvdy1pZD1hMjk1ZmZlNS1lYWU2LTUxYmQtOTc0My1iNzcxYTEyYTdmMmFfMTQ1NTYxOTA1NzAzN180MjAxXzM2MDImcmFuaz0w?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg",
      "id":"752u622p-9ee8111dafc44ed7ad131df75599f7da"
    },{
      "position":[57.70525,11.9691],
      "distance":7297,
      "title":"Bengans City",
      "averageRating":0.0,
      "category":{
        "id":"shop",
        "title":"Store",
        "href":"http://places.cit.cc.api.here.com/places/v1/categories/places/shop?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg",
        "type":"urn:nlp-types:category",
        "system":"places"
      },
      "icon":"http://download.st.vcdn.nokia.com/p/d/places2_stg/icons/categories/09.icon",
      "vicinity":"Östra Hamngatan 46-48<br/>SE-411 09 Göteborg",
      "having":[],
      "type":"urn:nlp-types:place",
      "href":"http://places.cit.cc.api.here.com/places/v1/places/7528lxx5-a66cf1a28e4e08addb0a95efd1c2f6ae;context=Zmxvdy1pZD1hMjk1ZmZlNS1lYWU2LTUxYmQtOTc0My1iNzcxYTEyYTdmMmFfMTQ1NTYxOTA1NzAzN180MjAxXzM2MDImcmFuaz0x?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg",
      "id":"7528lxx5-a66cf1a28e4e08addb0a95efd1c2f6ae"
    },{
      "position":[59.3299,18.06539],
      "distance":403148,
      "title":"Bengans",
      "averageRating":0.0,
      "category":{
        "id":"shop",
        "title":"Store",
        "href":"http://places.cit.cc.api.here.com/places/v1/categories/places/shop?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg",
        "type":"urn:nlp-types:category",
        "system":"places"
      },
      "icon":"http://download.st.vcdn.nokia.com/p/d/places2_stg/icons/categories/09.icon",
      "vicinity":"Drottninggatan 20<br/>SE-111 51 Norrmalm",
      "having":[],
      "type":"urn:nlp-types:place",
      "href":"http://places.cit.cc.api.here.com/places/v1/places/752u6sce-b196e1a1e7004b61b0d59e7fe70d98a8;context=Zmxvdy1pZD1hMjk1ZmZlNS1lYWU2LTUxYmQtOTc0My1iNzcxYTEyYTdmMmFfMTQ1NTYxOTA1NzAzN180MjAxXzM2MDImcmFuaz0y?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg",
      "id":"752u6sce-b196e1a1e7004b61b0d59e7fe70d98a8"
    }]
  },
  "search":{
    "context":{
      "location":{
        "position":[57.729,11.855],
        "address":{
          "text":"Gunnar Engellaus väg<br/>SE-418 78 Gothenburg<br/>Sweden",
          "street":"Gunnar Engellaus väg",
          "postalCode":"418 78",
          "district":"Sörred",
          "city":"Gothenburg",
          "county":"Gothenburg",
          "stateCode":"Vastra Gotaland County",
          "country":"Sweden",
          "countryCode":"SWE"
        }
      },
      "type":"urn:nlp-types:place",
      "href":"http://places.cit.cc.api.here.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPUd1bm5hcitFbmdlbGxhdXMrdiVDMyVBNGc7bGF0PTU3LjcyOTtsb249MTEuODU1O3N0cmVldD1HdW5uYXIrRW5nZWxsYXVzK3YlQzMlQTRnO2NpdHk9R290aGVuYnVyZztwb3N0YWxDb2RlPTQxOCs3ODtjb3VudHJ5PVNXRTtkaXN0cmljdD1TJUMzJUI2cnJlZDtzdGF0ZUNvZGU9VmFzdHJhK0dvdGFsYW5kK0NvdW50eTtjb3VudHk9R290aGVuYnVyZztjYXRlZ29yeUlkPXN0cmVldC1zcXVhcmU7c291cmNlU3lzdGVtPWludGVybmFs;context=c2VhcmNoQ29udGV4dD0x?app_id=lY6OORYIflIj1bDoXj0B&app_code=mGoIbmz9I0Ed0i6hvMzGWg"
    }
  }
}

我想获得可选字段&#34;地址&#34;在我的项目中:[{},...]根据此引用回复:https://developer.here.com/rest-apis/documentation/places/topics_api/object-link.html#place-link

address Object[Address]; optional   The address of the place. 

1 个答案:

答案 0 :(得分:0)

找到此文档,概述了端点我正在使用。它没有提到任何添加其他响应字段的方法:

https://developer.here.com/rest-apis/documentation/places/topics_api/resource-search.html

如果没有进一步的要求,这是不可能的。