Retrieve a model's UID from short link

Hello there

I am developing an app and I want to make it as easy as possible for users to embed SketchFab models.
My app is basicly a WYSIWYG markdown editor.
I want to allow users to copy and paste a short link into my editor to create something like the following:

![](https://skfb.ly/WVBN)

I would then transform the Markdown into your embed HTML, getting all the details (model link, user et al) from your REST Api (or perhaps oEmbed) but I need a UID to make these request.
I currently have it working from YouTube for eg:

![](https://youtu.be/dQw4w9WgXcQ)

But the YouTube link above includes the ID, so if I do a substring I can get the ID.

Is it possible to get a model’s UID from a short-link?
Are short links auto-generated? If so how long do they last for?

Do you understand what I am doing here?

Thanks,

Luke

Another point I have just came across.
Is it possible for your oEmbed service to accept short-link?
For eg:

https://sketchfab.com/oembed?url=https://skfb.ly/ji3h2d0a

I think that would be a solution, then I could use the returned HTML.

Currently the response I get is:

{ "detail": {
  "__all__": [
    "Unexpected case: ShortURL doesn't refer to a a model nor a collection" 
]}}

Short URLs aren’t supported by our oEmbed endpoint because they can point to different things (models, collections etc). The best way forward is to resolve the short URL on your end, check that it’s a model and then generate the embed code from that.

I noticed that the Short URL resolves by redirecting to: https://sketchfab.com/s/XXX which inturn redirects to the full URL.
So in code I tried doing a HTTP Get request to that endpoint and using the Location header as the full URL, but I get a CORS error.

Is there another way to resolve the Short URL?

We don’t have another way to resolve those links, other than following the redirects, sorry.

hmmm… I would like to place a formal feature request for your oEmbed service to accept short-link

For eg:

https://sketchfab.com/oembed?url=https://skfb.ly/ji3h2d0a

That would be the ideal solution for me and would allow my users to easily embed SketchFab models via Markdown.

Thanks,
Luke

I’m sorry but this is not on our roadmap for now. Which app is this for? How many users do you have?

This is a new app that I am creating, I don’t have any users yet as I am still developing it.
I might go live towards end of 2021/begin 2022… So plenty of time :slight_smile:

Right. We’ll definitely won’t be able to prioritize it then, sorry :slight_smile:

That’s okay, I have the long link working in Markdown like this:

![](https://sketchfab.com/3d-models/a-statue-of-roy-high-priest-of-amun-55fc3feb375842779c07c2a9b4b9f5ea)

So I will leave it for now and revisit this when I’m closer to delivery.

2 Likes