Ids and permanent ids
Every package, element and relationship has two ids:
| Field | What it is | Changes when |
|---|---|---|
id |
The database id. Every call takes it: GET /v1/elements/{elementId}, the filters, every change you make. |
The item is brought back as a new row: Restore Project, a Replace from a file, or FarkiBot’s Modify M1 rewriting a model. |
uid |
The permanent id: 26 lowercase letters and digits, such as 0f08fza5n3g24hqrkbw0hsr51w. |
Never. It survives everything above. |
{ "object": "element", "id": "jn796wyq11v6905qdm5kq60b8n8jswet", "uid": "5ab744vkp84pp97bf02q3928xt", "originUid": null, "name": "Customer Portal", ...}Which to store
Section titled “Which to store”Store the uid when another system keeps a link to a Farkitect item for longer than a session: a CMDB record, a ticket, a document. Use the id for calls you make straight away.
To get from a stored uid back to the item, and its current id, pass it to the list:
curl "https://api.farkitect.com/v1/projects/$PROJECT/elements?uid=5ab744vkp84pp97bf02q3928xt" \ -H "Authorization: Bearer $FARKITECT_API_KEY"The page holds the one element with that permanent id, or is empty when the project has none. GET …/packages?uid= and GET …/relationships?uid= work the same way. A uid is unique across Farkitect, but a list only ever looks in its own project.
What keeps a uid, and what makes a new one
Section titled “What keeps a uid, and what makes a new one”| In the app | Permanent ids |
|---|---|
| Editing, moving, renaming | Kept |
| Restore Project | Kept |
| Replace from a file, and FarkiBot’s Modify M1 | Each item that matches one in the model it replaces keeps that item’s uid; new items get new ones |
| Copy and Paste, Clone, File › Import, Import as Copy, Farketplace | New: a copy is a new item, even when made from a file that carries uids |
The same element in two projects has two different uids.
Events and webhooks
Section titled “Events and webhooks”Every event names its item’s uid beside its id (item.uid), the deletion too, so a program that stored a uid knows which of its records an event is about.
Diagrams, catalogs, boards and charts have a permanent id too: each view’s uid, in GET /v1/projects/{projectId}/views and a diagram’s read. A Restore can give a view a new id, never a new uid. An event about a view carries its uid too (since Release 384).
originUid
Section titled “originUid”originUid is set on a copy included from another project, a metamodel’s or a model’s items and views: the original’s uid, the same in every project that includes it. It is null for a project’s own items.