简体   繁体   中英

An HTTP request to the Yelp API returns a missing parameter error

I try to retrieve some information from Yelp API for a UWP app. As they say here , I need to pass some parameter as header for a HTTP request, and then perform a Json request using this link . I know how to parse a Json file once I get it, but I have no idea how to get access to this file.

If for example I put https://api.yelp.com/v2/search?term=food&location=San+Francisco&oauth_consumer_key=MYKEY&oauth_token=MYTOKEN&oauth_signature_method=hmac-sha1 this link on my browser

it return {"error": {"text": "One or more parameters are missing in request", "id": "MISSING_PARAMETER", "field": "oauth_signature"}}

How should I enter this oauth_signature ?

According to their specification :

Each request must contain the following OAuth protocol parameters:

oauth_consumer_key Your OAuth consumer key (from Manage API Access).

oauth_token The access token obtained (from Manage API Access).

oauth_signature_method hmac-sha1

oauth_signature The generated request signature, signed with the oauth_token_secret obtained (from Manage API Access).

oauth_timestamp Timestamp for the request in seconds since the Unix epoch.

oauth_nonce A unique string randomly generated per request.

add the required field in your request and see what response you get. here you are missing oauth_timestamp , oauth_nonce , and oauth_signature fields in the request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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