-1

I am in need of using the Stack Overflow API for my website. I've gone through the documentation and I got the API key and client credentials. But my question is, I am able to send my question through the endpoint of Stack Overflow like this:

"https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=relevance&q=" + encodeUrl(arguments) + "&accepted=True&site=stackoverflow";

"arguments" here is a string variable containing a Question.

But my question is, then what's the use of the API key and other credentials? If there are advantages, can you please tell me how to send a request using credentials?

0

1 Answer 1

0

From the registration page:

Why Register?

Because it's the neighborly thing to do. We like to know who is using our API, and how, so we can have the metrics we need to support your application and improve the API together.

Once it's ready for public consumption, we'll help you promote your registered application here on Stack Apps.

Upon registering, you'll be provided an API key which grants your app a much larger per-day request quota than using the API anonymously.

So your solution works right now, but only 300 times a day. If that is sufficient for your purposes, you can skip the registration part, but see the first and second paragraph for other reasons to do it anyway.

After obtaining an API key, you can simply pass it as an extra parameter named key, as described e.g. here. If you succeeded in acquiring an access_token you can pass it as well, but note that it's associated to a particular user and depending on the scope you requested it might give access to some of your private information.

2
  • Can you please tell me how to send request without concatenating apikey in the url. I currently have my apikey, client id and secret. I am unable to follow the steps given in StackExchange site. Thanks.
    – Deepak
    Commented Aug 4, 2019 at 17:09
  • 1
    It must be in the URL, since the API method only supports GET requests ...
    – Glorfindel
    Commented Aug 4, 2019 at 17:12

Not the answer you're looking for? Browse other questions tagged .