Canonicals are a really important concept in FHIR. If you don't know how they work, have a look here: What is a canonical?
You can automate canonical resolving by using the following URL:
There are two important parameters that you should provide:
canonical: Canonical URL that you are trying to resolve.
scope: Scope in which you want to resolve the canonical URL.