Method Web.Api.Api()->parse_canonical_url()
- Method parse_canonical_url
mapping(string:string|mapping) parse_canonical_url(string url)
- Description
This can be used to parse a link resource returned from a REST api. Many API returns stuff like:
{ ... "pagination" : { "next" : "/api/v1/method/path?some=variables&page=2&per_page=20" } }
If pagination->next is passed to this method it will return a path of /method/path, given that the base URI of the web api is something along the line of https://some.url/api/v1, and a mapping containing the query variables (which can be passed as a parameter to any of the get, post, delete, put methods.
- Parameter url
- Returns
"path" : string "params" : mapping