ZWeb.API.UrlsController (Portico/Z v0.1.0)
Basically https://bit.ly (url shortener) but API-only :)
In FileMaker/Portico, you can check cache_data
for API
implementation scripts.
Link to this section Summary
Link to this section Functions
create(conn, params)
Create a ZSchemas.Url
Parameters
"url"
- (required) - the URL to shorten!
Other parameters are forwarded to Z.Urls.insert_url/2
as args
-
basically these are arguments to the hash function that creates the
identifier
.
Response
The response is a thin wrapper around a ZSchemas.Url
, with an extra
shortened_url
key for convenience.
{
url: %ZSchemas.Url{},
shortened_url: "https://z.explo.org/..."
}
delete(conn, map)
Delete a ZSchemas.Url
Note that id
in the URL maps to the identifier
(short-code) of the
URL to be deleted.
Response
Returns a ZSchemas.Url
struct on success, and any error message
otherwise.
show(conn, map)
Show (redirect to) a ZSchemas.Url
Query Parameters
identifier
- the short-code identifier of the URL
Note that when you're calling this URL from the
ZWeb.Router.Helpers.urls_url/3
helper (eg something like
https://z.explo.org/u/something
, the identifier
parameter is just
part of the URL and doesn't need to be specified as an extra query
parameter.