valhalla / valhalla-docs

DEPRECATED: The up-to-date documentation for valhalla can be found in the main repository.
Other
76 stars 44 forks source link

Add hyperlinks for API query examples (but without API key) #138

Open nvkelso opened 7 years ago

nvkelso commented 7 years ago

Currently the Mobility docs don't link out, and the are confusing with the API key (copy pasting them into the URL bar will generate a 429 error).

For example, this URL is written in text, but not hyper linked:

because if you type it in to the address bar, it’ll 429

while Search would keep the link text with the API key, but change the hyperlink URL to:

Example:

rmglennon commented 7 years ago

From some testing with markdown and HTML tags, it works best with a format like this:

> [/route?json={"locations":[{"lat":40.749706,"lon":-73.991562,"type":"break","street":"Penn Plaza"},{"lat":40.73093,"lon":-73.991379,"type":"break","street":"Wanamaker Place"}],"costing":"multimodal","costing_options":{"transit":{"use_bus":"1.0","use_rail":"0.0","use_transfers":"0.3"},"pedestrian":{"walking_speed":"4.1"}}}&api_key=mapzen-xxxxxxx](https://valhalla.mapzen.com/route?json={"locations":[{"lat":40.749706,"lon":-73.991562,"type":"break","street":"Penn Plaza"},{"lat":40.73093,"lon":-73.991379,"type":"break","street":"Wanamaker Place"}],"costing":"multimodal","costing_options":{"transit":{"use_bus":"1.0","use_rail":"0.0","use_transfers":"0.3"},"pedestrian":{"walking_speed":"4.1"}}})

The base URL is stated earlier in the topic, so removing it from the link text that displays on the page. This matches the Search examples.

To do:

rmglennon commented 7 years ago

As part of the requirement to use an API key with all requests, I have had to remove the URL to make these links just be code blocks (for now).

In the near-future, they will be updated to use the fancy API key switching we do for all documentation.