umbraco / Umbraco.Heartcore.Issues

3 stars 1 forks source link

Redirect API query #140

Closed daveve80 closed 4 days ago

daveve80 commented 4 weeks ago

Summary

At this moment the redirect API ( https://cdn.umbraco.io/redirect ) is limited to 1000 redirects, whenever we'd hit that limit, the old (or new) pages won't get redirected anymore, because we simply can't fetch more. Much faster and friendlier would be to query the redirect API directly so we don't have to fetch all 1000 results on each and every page that has a redirect.

E.g.

I am now using: const redirects = await client.delivery.redirect.getAll()

Which returns an object with ALL redirects.

Something along the line of:

const searchstring = "/fullpath/page/this-is-the-detail-page"/
const redirects = await client.delivery.redirect.getAll(searchstring)

Which I expected to return the specific page.

Use case

Sometimes and URL will change, because the content changes. In such a case, we would like the visitor to be redirected to the new url, because otherwise he'll end up with a 404 error. This is now possible, but limited for 1000 redirects only. Might be less, if each and every node is counted. For example if I change the node with lots of childeren under it, one redirect might be enough to affect 1000 pages. Next to that, fetching 1000 redirects on each and every visit might take a long time. I would like to search instantly instead so only one result is returned.

github-actions[bot] commented 4 weeks ago

Hi there @daveve80!

Firstly, a big thank you for your suggestion. Every piece of feedback we receive helps us to make Heartcore better.

We really appreciate your patience while we wait for our team to have a look at this. We'll assess whether your suggestion is something we can action and let you know roughly what you can expect next.

We wish we could work with everyone directly and assess your suggestion immediately but we're in the fortunate position of having lots of feedback to work with and only a few humans who are able to do anything with it. We are making progress though, and we'll keep you posted when we have something to report!

Thanks, from your friendly Umbraco GitHub bot šŸ¤– šŸ™‚

jmf-umbraco commented 3 weeks ago

Hi @daveve80,

Thanks for the suggestion!

Firstly, we could probably afford to make this a bit more obvious in our docs, but the redirect endpoint does support pagination via the page and pageSize query string parameters. For more information, see https://docs.umbraco.com/umbraco-heartcore/api-documentation/redirect

However, we still see value in your suggestion. We'll look into adding an endpoint to retrieve redirect info from a given path. No ETA at this stage, but we'll keep you posted here when we have anything to share.

jmf-umbraco commented 1 week ago

Hi @daveve80,

Good news - we've created this endpoint and you can expect to see that rolled out later this week. We'll also get the documentation updated to provide you with an example for how to call it.

daveve80 commented 4 days ago

That's great news, thanks. I see the documentation has been updated already. I am going to test this as soon as a I can!

jmf-umbraco commented 4 days ago

Hi @daveve80, this was rolled out late last week. It should be available now šŸ˜„