SkyBrud Redirect API?
# help-with-umbraco
r
Does anyone know if this package has an API? Assume this won’t get exposed via the Content Delivery API so wonder if they have their own.
s
The package essentially works as a 404 handler. If a request results in a 404 response, it will check if it has a redirect for the request, and redirect instead. It won't work with the delivery API. Same with the built in URL tracking.
a
Skybrud Redirects doesn't work with Umbraco's content delivery - at least not directly. Umbraco's content delivery works the way that you can request a content route specifically, or a media route specifically. There isn't an endpoint for specifying a generic route, and then determining from the response whether the route represents a content or media item - or an external redirect. Umbraco's content delivery API also doesn't offer a good away to handle redirects within the content and media endpoints. So for this to work, there are a few ways you could go instead: Approach 1 1. look for the route via the content/media endpoint 2. if not found, look for a redirect matching the route - this isn't supported by Skybrud Social, so you'd have to create your own endpoint for this This could potentially be 2-3 requests between the frontend and backend, so an alternative could be: Approach 2 1. create a custom endpoint that takes the route as a parameter 1. check if a content node exists with the route 2. check if a media exists with the route 3. check if a redirect exists with the route This will then be a single request between the frontend and backend, but require you to implement more code on your own. Approach 3 If you have some kind of middleware between your frontend and backend, you could also create a custom endpoint that lists all redirects, and then cache those within the middleware. But with caching, there should also be a way to invalidate the cache - e.g.: if a user creates or updates a redirect. Anyways - Skybrud Redirects doesn't offer a content delivery API on it's own. Primarily because I hadn't needed this my self, and you're only the second person to ask about this. But also because - as described above - there isn't just one way to go about this.
r
Thanks both, makes sense, appreciate the detailed reply. We're using a headless frontend so whilst in someways we don't need to use all of Skybrud Redirects it does mean we can use the interface for it instead of rolling our own. Our front end team essentially need a list of redirects and we don't use Umbraco to handle any of the actual redirects
7 Views