首页 文章

Angular 4 API HttpClient Post / Get in Zomato

提问于
浏览
0

我有这个功能但是zomato继续将其返回为403(无效的API) . 我不确定是否还需要其他功能/参数来填充用户密钥

url='https://developers.zomato.com/api/v2.1/search?count=50&lat=111&lon=111&radius=1500&order=desc'
sendGetRequest() {
             const headers = new HttpHeaders()
                 .set('cache-control', 'no-cache')
                 .set('content-type', 'application/json')
                 .set('user-key', 'mykeygoeshere')

             return this.httpClient
                        .get(this.url, '', { headers: headers })
                        .subscribe(res => res.json);
    }

1 回答

  • 0

    我通过生成API密钥尝试了搜索请求并获得了成功的响应 . 所以你需要有一个合适的API密钥 .

    Request:

    curl -X GET --header "Accept: application/json" --header "user-key: a2716934XXXXXXXXXXXX21ced1a5a35" "https://developers.zomato.com/api/v2.1/search"

    Response:

    {
      "results_found": 1272959,
      "results_start": 0,
      "results_shown": 20,
      "restaurants": [
        {
          "restaurant": {
            "R": {
              "res_id": 17842104
            },
            "apikey": "a2716934XXXXXXXXXXXX21ced1a5a35",
            "id": "17842104",
            "name": "Mr.",
    

相关问题