Fork me on GitHub

CanonicalURL

Canonical URL provides a simple RESTful service to obtain the canonical URL declared by a page in its HTML.

The API supports fetching the canonical URL based on a number of selectors:

  • link[rel='canonical'] - Fetches the declared canonical URL element
  • meta[property='og:url'] - Fetches the declared canonical URL as defined by the OpenGraph protocol

Examples

curl https://canonicalurl.info/get?url=http%3A%2F%2Fmashable.com%2F

Parameters

Name Value Comments
&url The URL to retrieve its canonical URL
&types The types of canonical URL to retrieve. Optional. By default the API will try to retrieve canonical and if there is no value, it will try opengraph. If you specify values it will search in the order the values are set (i.e. opengraph,canoncail will search for opengraph and the canonical)
canonical
opengraph
&callback The name of the callback JavaScript function when using JSONP (and format is json) Optional.
&format The output format of the result Optional. By default it will return json
json When there is no canonical value the API will return an empty string
text When there is no canonical value the API will return an empty string