Zomato API与Android应用程序集成

时间:2017-07-13 20:17:08

标签: android zomato-api

{
    "code":403,
    "status":"Forbidden",
    "message":"Invalid API Key"
}

this is what i am getting as request URL

我正在尝试使用我的Generated API密钥使用Zomato API的请求URL。但每当我尝试在fiddler和任何浏览器上使用URL时,它都会显示INVALID API KEY的错误。

为什么我得到这个无效的API密钥,我该如何解决?

  

EDITED:   此图像可能会清除我如何使用密钥

this image might clear how i am using the key

  

xxxxx只是一个例子。这就是我使用api密钥然后使用URL的方法!

2 个答案:

答案 0 :(得分:0)

根据Zomato API https://developers.zomato.com/documentation#!/common/categories,您应该在标题

中传递API密钥

您可以从此处获取API密钥:https://developers.zomato.com/api#headline2

答案 1 :(得分:0)

在参数中传递api密钥使客户端难以保密他们的API密钥,他们往往会定期泄漏密钥。更好的方法是将其传递到请求URL的标头中。您可以在代码中设置用户密钥标头等于您的API密钥。为了测试您的请求,您可以在Google Chrome中使用Postman应用。

通过将用户密钥头设置为api-key,向端点发送get请求。 你可以参考这个邮递员截图,看看它是否有效: