简体   繁体   English

Zomato API与Android应用程序中的集成

[英]Zomato API integration with in android app

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

this is what i am getting as request URL 这就是我作为请求URL得到的

I am trying to use the request URL for Zomato API using my Generated API key. 我正在尝试使用我的Generated API密钥为Zomato API使用请求URL。 But every time i try to use the URL on fiddler and any browser it is showing this error of INVALID API KEY . 但是每次我尝试在提琴手和任何浏览器上使用URL时,都会显示此错误的INVALID API KEY

Why i am getting this invalid API key and how can i solve it? 为什么我得到这个无效的API密钥,我该如何解决?

EDITED: this image might clear how i am using the key 编辑:此图像可能会清除我如何使用密钥

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

xxxxx is just an example . xxxxx只是一个例子。 This is how i am using the api key and then using the URL! 这就是我使用api键然后使用URL的方式!

According to Zomato API https://developers.zomato.com/documentation#!/common/categories you shoud pass your API key in header 根据Zomato API https://developers.zomato.com/documentation#!/common/categories,您应该在标头中传递API密钥

you can get an API key from here: https://developers.zomato.com/api#headline2 您可以从此处获取API密钥: https : //developers.zomato.com/api#headline2

passing api key in parameters makes it difficult for clients to keep their APIkeys secret, they tend to leak keys on a regular basis. 在参数中传递api密钥会使客户端很难保留其APIkey的机密性,它们倾向于定期泄漏密钥。 A better approach is to pass it in header of request url. 更好的方法是将其传递到请求url的标头中。 You can set user-key header in your code equals to your api key. 您可以在代码中将用户密钥标头设置为等于api密钥。 For testing your request Url you can use Postman app in google chrome. 为了测试您的请求网址,您可以在Google chrome中使用Postman应用程序。

send a get request to your endpoint by setting user-key header to your api-key. 通过将用户密钥标头设置为您的api-key将get请求发送到端点。 You can refer to this postman screenshot to see it is working: 您可以参考此邮递员屏幕截图以查看其工作原理:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM