# Tip for generating a direct URL to an entity

**URL:** <https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227>\
**Category:** API & Programming\
**Created:** [November 18, 2021, 12:56pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227 "2021-11-18T12:56:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [November 18, 2021, 12:56pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/1 "2021-11-18T12:56:40Z")

</div>

So I was doing something like the JavaScript below for generating a URL to an entity, which when clicked opens the entity in a new tab…

```auto
function makeEntityUrl(spaceDb, entityName, entityPubId) {
  const entity = entityName.replace(/[^\d\w_\-!$*()+',.]+/g, "-") + `-${entityPubId}`;
  return `https://test-sandbox.fibery.io/${spaceDb.replace(" ", "_")}/${entity}`;
}

```

But during testing just now it seems like you don’t even need to include the entity name so this works just as well (as far as I can tell without extensive testing):

```auto
/**
 * @param spaceDb - in format 'space/database'
 * @param entityPubId - the public ID, a number
 */
function makeEntityUrl(spaceDb, entityPubId) {
  return `https://test-sandbox.fibery.io/${spaceDb.replace(" ", "_")}/${entityPubId}`;
}

const r = makeEntityUrl('Example Space/Database A', 2)
console.log(r) // https://test-sandbox.fibery.io/Example_Space/Database_A/2

```

---

<div class="post-metadata">

**Author:** ![mdubakov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mdubakov/32/10_2.png) [@mdubakov](https://community.fibery.io/u/mdubakov)\
**Post date:** [November 18, 2021, 1:13pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/2 "2021-11-18T13:13:54Z")

</div>

Entity Id is enough, since you can rename the entity and URL has to work

---

<div class="post-metadata">

**Author:** ![radek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/radek/32/4249_2.png) [@radek](https://community.fibery.io/u/radek)\
**Post date:** [November 19, 2021, 7:27am UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/3 "2021-11-19T07:27:38Z")

</div>

Indeed - there should be one unique ID facing the public (i.e. URLs).

I just wonder that fibery is exposing the sequential IDs.

The issue is that it demonstrates some context.

In some projects we used internal IDs (could be sequential ints) and assigned “public” IDs (uuids).

By that we solved - non exposing ID context and always working URLs.

Might be a suggestion for improvement?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 20, 2021, 6:55pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/4 "2021-11-20T18:55:41Z")

</div>

I’m curious to know what sensitive info you think is exposed by having sequential identifiers?  
Given that they are not re-used, it doesn’t tell you how many entities exist in a given database (since 101 might be created and 100 deleted).  
It doesn’t tell you when they were created (in date/time terms) although you can deduce that one entity was created after another.

---

<div class="post-metadata">

**Author:** ![radek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/radek/32/4249_2.png) [@radek](https://community.fibery.io/u/radek)\
**Post date:** [November 24, 2021, 7:07am UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/5 "2021-11-24T07:07:28Z")

</div>

Typically business related stuff. In those cases you do not delete the previous entries, you change their status as closed or irrelevant.  
Hence you expose the amount when someone tries to reach the top number.

Additional advantage of UUIDs is that you do not need to add entity name into the URL. It can be like:  
[company.fibery.io/e/6ad4e412-270f-4278-a5c3-d9ed0179c328](http://company.fibery.io/e/6ad4e412-270f-4278-a5c3-d9ed0179c328)

And thus the URL always works even when you rename the space (app) , folder, move the entity among spaces, etc.

I am not saying replace the context aware URLs (those are for some visual and browser tab completion convenience), I am saying for the links sharing - UUIDs are better.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 24, 2021, 8:48am UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/6 "2021-11-24T08:48:29Z")

</div>

> [@radek](#):
>
> Hence you expose the amount when someone tries to reach the top number.

I’m not sure I understand what you mean by ‘reaching the top number’. Are you saying that users can deduce the total number of entities in a given database?  
That is not quite the case, as I said, since it only tells you how many have been created to date, and not how many are actually in use.  
If that bothers you, then you can randomly create a whole bunch of dummy entities and immediately delete them to obfuscate this information(!)

> [@radek](#):
>
> you do not need to add entity name into the URL

FYI, the Fibery URLs for entities do not actually need the name, as Dimitri points out above.

Also, because of the [way UUIDs are formed](https://en.wikipedia.org/wiki/Universally_unique_identifier), they actually reveal more info than the public ID ☹

---

<div class="post-metadata">

**Author:** ![radek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/radek/32/4249_2.png) [@radek](https://community.fibery.io/u/radek)\
**Post date:** [November 24, 2021, 1:45pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/7 "2021-11-24T13:45:08Z")

</div>

> FYI, the Fibery URLs for entities do not actually need the name, as Dimitri points out above.

Apologies I misplaced entity and database in the Fibery terms.

> Also, because of the [way UUIDs are formed](https://en.wikipedia.org/wiki/Universally_unique_identifier), they actually reveal more info than the public ID ☹

I am not sure what you are referring to in relation to UUID v4.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 24, 2021, 2:16pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/8 "2021-11-24T14:16:16Z")

</div>

> [@radek](#):
>
> I am not sure what you are referring to in relation to UUID v4

Ah, sorry, I had a recollection that it was UUID v1 in use.

---

<div class="post-metadata">

**Author:** ![radek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/radek/32/4249_2.png) [@radek](https://community.fibery.io/u/radek)\
**Post date:** [November 24, 2021, 3:32pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/9 "2021-11-24T15:32:48Z")

</div>

So to wrap it: Just imagine these differences as to be seen during screensharing within online calls etc:

[https://company.fibery.io/B2BRealtions/PotentialClients/4](https://company.fibery.io/B2BRealtions/PotentialClients/4)

vs

[http://company.fibery.io/e/6ad4e412-270f-4278-a5c3-d9ed0179c328](http://company.fibery.io/e/6ad4e412-270f-4278-a5c3-d9ed0179c328)

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 24, 2021, 7:33pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/10 "2021-11-24T19:33:58Z")

</div>

So it’s the space name/database name that is particularly sensitive, more so than the entity id?  
It wouldn’t be so bad if it showed the following, right?

https://company.fibery.io/af3d5/98eb2/4

---

<div class="post-metadata">

**Author:** ![radek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/radek/32/4249_2.png) [@radek](https://community.fibery.io/u/radek)\
**Post date:** [November 24, 2021, 10:39pm UTC](https://community.fibery.io/t/tip-for-generating-a-direct-url-to-an-entity/2227/11 "2021-11-24T22:39:35Z")

</div>

That is one positive.

The other is as mentioned:

> Additional advantage of UUIDs is that you do not need to add _space/database_ name into the URL. It can be like:  
> [company.fibery.io/e/6ad4e412-270f-4278-a5c3-d9ed0179c328](http://company.fibery.io/e/6ad4e412-270f-4278-a5c3-d9ed0179c328)
> 
> And thus the URL always works even when you rename the space (app) , folder, move the entity among spaces, etc.
