URL Templating: Difference between revisions

Jump to navigation Jump to search
m
Fix missing quotes
(Created page with "It is sometimes useful to allow a client to construct a URL. This is frequently done using out of band information but that has the disadvantage that the server is no long...")
 
m (Fix missing quotes)
Line 4: Line 4:
Let's say we want to tell a custom client for this wiki where it can find a page with a given title. We can do this by sending the following [[link header]]:
Let's say we want to tell a custom client for this wiki where it can find a page with a given title. We can do this by sending the following [[link header]]:


  Link: <https://docs.delftsolutions.nl/index.php?title={title}>; rel=search; templated=true
  Link: <https://docs.delftsolutions.nl/index.php?title={title}>; rel="search"; templated="true"


In our [[Media Types | media type documentation]] we then tell the client that they have fill in the ''title'' variable and can do a GET on the resulting page. If we later decide to use pretty urls we can simply change the server to return the following link header:
In our [[Media Types | media type documentation]] we then tell the client that they have fill in the ''title'' variable and can do a GET on the resulting page. If we later decide to use pretty urls we can simply change the server to return the following link header:


  Link: <https://docs.delftsolutions.nl/{title}>; rel=search; templated=true
  Link: <https://docs.delftsolutions.nl/{title}>; rel="search"; templated="true"


Clients will then automatically use the new URL structure without needing an update.
Clients will then automatically use the new URL structure without needing an update.

Navigation menu