You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'd like for Shlink to generate/create multi-segment slugs for us (as opposed to multi-segment custom slugs) by being able to provide a slug prefix. To do this, we'd like to see an enhancement made to the /rest/v{version}/short-urls POST endpoint for creating short URLs that allows for setting a slug prefix. This can be used to generate multi-segment slugs. Or just to have a slug contain a prefix.
Currently, to create a multi-segment slug, you must provide the full custom slug. This adds implementation burden on the client to create unique slugs rather than depending on Shlink's capabilities & features, and configurations. Rather than setting a complete custom slug, we'd like to set a multi-segment prefix, say via a slugPrefix property (name can be flushed out) on the POST request. Shlink would then create a multi-segment slug of https://exam.ple/{slugPrefix}{generatedSlug}
would generate a URL of https://exam.ple/docs/abc123 where abc123 is a slug generated by Shlink.
For those that might prefer hyphens or other formatting, "slugPrefix": "docs-" would generate https://exam.ple/docs-abc123. And "slugPrefix": "FOO" would generate https://exam.ple/FOOabc123.
In the event a slugPrefix and a customSlug is provided, I would expect the behavior to be to create a URL of https://exam.ple/{slugPrefix}{customSlug}. This seems the most straight forward way to handle that use case. And allows the flexibility when generating multi-segment slugs in code. For example, the code may want to always use a specific slugPrefix, while typically having Shlink generate the (suffix) slug (and thus not set customSlug) but in some circumstances may want to provide a specific (suffix) slug, and would thus set customSlug to the desired (suffix) slug.
Use case
We need to generate URLs both within our application, which has web-app, Apple, and Android UI clients, and our business website. Our mobile apps need to internally determine if the short URL is one the App needs to handle directly, displaying the requested data or feature in the app, or if it is one to forward to the mobile device's web browser for display. The cleanest way to do this for us to do this is to use multi-segmented slugs. For example https://exam.ple/app/abc123 gets handled by the mobile app directly, and https://exam.ple/web/abc123 is forwarded to the browser. (We'd likely use shorter single character "prefixes", but for illustrative purposes app and web work.)
Currently to do this, our clients will need to generate full custom slugs when creating a short URL. This adds a lot of implementation complexity as we need to generate those slugs in a way that guarantees uniqueness across multiple running instances. In effect, taking over a core responsibility from Shlink.
Another use cases would be when it is desired to have some human (and/or machine) recognizably in a short URL. For example https://exam.ple/Dxxxxxx is a link to documentation, https://exam.ple/Pxxxxxx is a link to a product, and https://exam.ple/Qxxxxxx is a link to a FAQ.
The text was updated successfully, but these errors were encountered:
Javaru
changed the title
Enhance 'create short URL' REST API endpoint to allow setting a multi-segment prefix
Enhance 'create short URL' REST API endpoint to allow setting a (multi-segment) prefix
Sep 29, 2023
acelaya
changed the title
Enhance 'create short URL' REST API endpoint to allow setting a (multi-segment) prefix
Support "path prefix" on short url creation
Sep 29, 2023
Summary
We'd like for Shlink to generate/create multi-segment slugs for us (as opposed to multi-segment custom slugs) by being able to provide a slug prefix. To do this, we'd like to see an enhancement made to the
/rest/v{version}/short-urls
POST endpoint for creating short URLs that allows for setting a slug prefix. This can be used to generate multi-segment slugs. Or just to have a slug contain a prefix.Currently, to create a multi-segment slug, you must provide the full custom slug. This adds implementation burden on the client to create unique slugs rather than depending on Shlink's capabilities & features, and configurations. Rather than setting a complete custom slug, we'd like to set a multi-segment prefix, say via a
slugPrefix
property (name can be flushed out) on the POST request. Shlink would then create a multi-segment slug ofhttps://exam.ple/{slugPrefix}{generatedSlug}
For example, for the request
would generate a URL of
https://exam.ple/docs/abc123
whereabc123
is a slug generated by Shlink.For those that might prefer hyphens or other formatting,
"slugPrefix": "docs-"
would generatehttps://exam.ple/docs-abc123
. And"slugPrefix": "FOO"
would generatehttps://exam.ple/FOOabc123
.In the event a
slugPrefix
and acustomSlug
is provided, I would expect the behavior to be to create a URL ofhttps://exam.ple/{slugPrefix}{customSlug}
. This seems the most straight forward way to handle that use case. And allows the flexibility when generating multi-segment slugs in code. For example, the code may want to always use a specificslugPrefix
, while typically having Shlink generate the (suffix) slug (and thus not setcustomSlug
) but in some circumstances may want to provide a specific (suffix) slug, and would thus setcustomSlug
to the desired (suffix) slug.Use case
We need to generate URLs both within our application, which has web-app, Apple, and Android UI clients, and our business website. Our mobile apps need to internally determine if the short URL is one the App needs to handle directly, displaying the requested data or feature in the app, or if it is one to forward to the mobile device's web browser for display. The cleanest way to do this for us to do this is to use multi-segmented slugs. For example
https://exam.ple/app/abc123
gets handled by the mobile app directly, andhttps://exam.ple/web/abc123
is forwarded to the browser. (We'd likely use shorter single character "prefixes", but for illustrative purposesapp
andweb
work.)Currently to do this, our clients will need to generate full custom slugs when creating a short URL. This adds a lot of implementation complexity as we need to generate those slugs in a way that guarantees uniqueness across multiple running instances. In effect, taking over a core responsibility from Shlink.
Another use cases would be when it is desired to have some human (and/or machine) recognizably in a short URL. For example
https://exam.ple/Dxxxxxx
is a link to documentation,https://exam.ple/Pxxxxxx
is a link to a product, andhttps://exam.ple/Qxxxxxx
is a link to a FAQ.The text was updated successfully, but these errors were encountered: