4

On API doc pages, the “link” link at the top-right of the “Try It” sections presents a URL with the wrong domain name:

"Try it" HUD

For example, on docs/similar, the URL displayed will be:

https://api.stackexchange.com/docs/similar#order=desc&sort=relevance&title=how%20do%20i%20get%20all%20sections&filter=default&site=craftcms

but it should be

https://api.stackexchange.com/2.2/similar?order=desc&sort=relevance&title=how%20do%20i%20get%20all%20sections&site=craftcms

(URI begins with docs/ instead of 2.2/.)

1 Answer 1

4

The link is correct. The purpose of that control is to provide a URL to the doc page with all the parameters prefilled. This is what most users expect and is similar to how that link control works on the rest of Stack Exchange.

To get a direct link to the API, click on the link next to the Run button:

Doc page links

This has a URL like:

https://api.stackexchange.com/2.2/similar?order=desc&sort=activity&title=blah&site=stackoverflow

Note that the value in the browser's address bar can be very similar to the link control's URL, except:

  • The address bar only updates when the Run button is pressed, the link control updates whenever a parameter is changed.
  • The address bar will then also contain the &run=true parameter -- which can sometimes be undesirable from a simplicity, economy, and length perspective.
0

You must log in to answer this question.

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