我的问题是当我尝试获取Yelp API时,我会一次又一次地收到此错误,并且我不确定为什么我已经检查了所有参数但仍无法从Yelp获取任何内容
我的Yelp API抓取链接 -
https://api.yelp.com/v2/search?term=food&ll=37.788022,-122.399797& oauth_consumer_key = MY_Consumer_Key &安培;组oauth_token = MY_TOKEN &安培; oauth_signature_method = HMAC- SHA1 &安培; oauth_signature = TOKEN_SECRET &安培; oauth_timestamp = 1456337018 &安培; oauth_nonce < / EM> = 1456337018
我的错误 -
text: "Signature was invalid",
id: "INVALID_SIGNATURE",
description: "Invalid signature. Expected signature base string:
获取&安培; HTTPS%3A%2F%2Fapi.yelp.com%2Fv2%2Fsearch&安培; 11%3D37.788022%252C-122.399797%26oauth_consumer_key%3DG02O6tXnFkSbsGYOJxCQDw%26oauth_nonce%3D1456337018%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp% 3D1456337018%26oauth_token%3DBPMpqKrD4dA4xGGHKtC_-xitzb5LRNn8%26term%3Dfood&#34; }
答案 0 :(得分:0)
您的API调用网址出错,yelp使用oauth 1.0a,哪一个网址参数应该按字母顺序排列(这个在您的错误说明中清楚说明),所以API调用网址应该是这样的:
https://api.yelp.com/v2/search?ll=37.788022,-122.399797&oauth_consumer_key=MY_Consumer_Key&oauth_nonce=1456337018&oauth_signature=TOKEN_SECRET&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1456337018&oauth_token=MY_TOKEN&term=food