LinkedDataApi
TypeScript SDK: the Linked data operations, 15 methods, each with its parameters, result and a complete example.
TypeScript SDK · @bimworks/sdk · class · 15 methods
Files, URLs, texts and identifiers linked to objects, which follow their objects to later Versions
Construct it with the client of the connect step: new LinkedDataApi(client). Each method is one operation of the API part, where it runs on its page.
| Method | Operation | Description |
|---|---|---|
addLinkTargets | AddLinkTargets | Link an existing item to more objects |
confirmLinkMatch | ConfirmLinkMatch | Confirm that a link to check is on the right object |
deleteLinkedData | DeleteLinkedData | Delete items from every object and Version |
downloadLinkedData | DownloadLinkedData | The content of one item, as uploaded |
endLink | EndLink | End a link from a Version on |
getLinkedData | GetLinkedData | One item with its links and their trail across Versions |
getLinkedDataCounts | GetLinkedDataCounts | Which objects of a Version have linked data |
getLinkedDataPolicy | GetLinkedDataPolicy | What this server accepts as linked data |
linkData | LinkData | Link files, URLs, texts or identifiers to objects of a Version |
listLinkedData | ListLinkedData | The linked data on a Version |
reattachLink | ReattachLink | Put a link on another object from a Version on |
replaceLinkedData | ReplaceLinkedData | Replace an item from a Version on |
restoreLinkedData | RestoreLinkedData | Bring deleted items back |
unlinkData | UnlinkData | Take links off their objects, on every Version |
updateLinkedData | UpdateLinkedData | Edit the title, description, category, validity or identifier system of an item |
addLinkTargets#
addLinkTargets(requestParameters: { addLinkTargetsRequest: AddLinkTargetsRequest }): Promise<LinkedDataLinks>Link an existing item to more objects. The item is shared, never copied. A target the item is already linked to on that Version is left as it is. Needs read rights on the item and write rights on the model of version_uuid.
| Operation | AddLinkTargets · POST /openapi/linkeddata/AddLinkTargets |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
addLinkTargetsRequest | AddLinkTargetsRequestrequired | The request: its properties are those of the model, its JSON that of AddLinkTargets's request body. |
Returns#
LinkedDataLinks — The item and the links made
Example#
import { AddLinkTargetsRequestFromJSON, AuthApi, Configuration, LinkedDataApi, LinkedDataLinksToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = AddLinkTargetsRequestFromJSON({
"item_uuid": "00000000-0000-0000-0000-000000000000",
"version_uuid": "<version uuid of the first demo model>",
"targets": [
{}
]
});
// 3. The call
const result = await new LinkedDataApi(client).addLinkTargets({ addLinkTargetsRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataLinksToJSON(result), null, 2));confirmLinkMatch#
confirmLinkMatch(requestParameters: { confirmLinkMatchRequest: ConfirmLinkMatchRequest }): Promise<ConfirmLinkMatchResult>Confirm that a link to check is on the right object. The check goes back to one pairing BIM.works was not sure of (an object matched by type and place after an upload, or the first of several objects with the link's GlobalId). That span becomes CONFIRMED, every later span the check stuck to becomes OK, and the pair is written as a compare pair override of the two Versions. version_uuid is a Version on which the link is marked CHECK. Needs write rights on the model.
| Operation | ConfirmLinkMatch · POST /openapi/linkeddata/ConfirmLinkMatch |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
confirmLinkMatchRequest | ConfirmLinkMatchRequestrequired | The request: its properties are those of the model, its JSON that of ConfirmLinkMatch's request body. |
Returns#
ConfirmLinkMatchResult — The confirmed span and the link with its trail
Example#
import { AuthApi, Configuration, ConfirmLinkMatchRequestFromJSON, ConfirmLinkMatchResultToJSON, LinkedDataApi } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = ConfirmLinkMatchRequestFromJSON({
"link_uuid": "00000000-0000-0000-0000-000000000000",
"version_uuid": "<version uuid of the first demo model>"
});
// 3. The call
const result = await new LinkedDataApi(client).confirmLinkMatch({ confirmLinkMatchRequest: request });
// 4. The result
console.log(JSON.stringify(ConfirmLinkMatchResultToJSON(result), null, 2));deleteLinkedData#
deleteLinkedData(requestParameters: { deleteLinkedDataRequest: DeleteLinkedDataRequest }): Promise<DeleteLinkedDataResult>Delete items from every object and Version. Restorable for retention_days, after which the content is purged. Needs write rights on the item's model; the user who added an item may also delete it within 24 hours without them. An item already deleted is answered as deleted; nothing is changed when one is refused.
| Operation | DeleteLinkedData · POST /openapi/linkeddata/DeleteLinkedData |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
deleteLinkedDataRequest | DeleteLinkedDataRequestrequired | The request: its properties are those of the model, its JSON that of DeleteLinkedData's request body. |
Returns#
DeleteLinkedDataResult — The items deleted
Example#
import { AuthApi, Configuration, DeleteLinkedDataRequestFromJSON, DeleteLinkedDataResultToJSON, LinkedDataApi } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = DeleteLinkedDataRequestFromJSON({
"item_uuids": [
"00000000-0000-0000-0000-000000000000"
],
"reason": ""
});
// 3. The call
const result = await new LinkedDataApi(client).deleteLinkedData({ deleteLinkedDataRequest: request });
// 4. The result
console.log(JSON.stringify(DeleteLinkedDataResultToJSON(result), null, 2));downloadLinkedData#
downloadLinkedData(requestParameters: { downloadLinkedDataRequest: DownloadLinkedDataRequest }): Promise<Blob>The content of one item, as uploaded. delivery: stream (the default) answers the content as the body: a file byte for byte as uploaded, with its media type and file name; a text whole; a URL or an identifier as text/plain. X-BimWorks-Sha256 carries the SHA-256 of a file or long text, ETag the same quoted.
| Operation | DownloadLinkedData · POST /openapi/linkeddata/DownloadLinkedData |
|---|---|
| Scope | links:read |
Parameters#
| Name | Type | Description |
|---|---|---|
downloadLinkedDataRequest | DownloadLinkedDataRequestrequired | The request: its properties are those of the model, its JSON that of DownloadLinkedData's request body. |
Returns#
Blob — The content
Example#
import { writeFileSync } from "node:fs";
import { AuthApi, Configuration, DownloadLinkedDataRequestFromJSON, LinkedDataApi } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = DownloadLinkedDataRequestFromJSON({
"item_uuid": "00000000-0000-0000-0000-000000000000",
"delivery": "stream",
"disposition": "attachment"
});
// 3. The call
const result = await new LinkedDataApi(client).downloadLinkedData({ downloadLinkedDataRequest: request });
// 4. The result
writeFileSync("null", Buffer.from(await result.arrayBuffer()));endLink#
endLink(requestParameters: { endLinkRequest: EndLinkRequest }): Promise<LinkedDataLinkResult>End a link from a Version on. The link stays on the older Versions and is neither shown nor followed from from_version_uuid on; unlike UnlinkData, the older Versions keep it. The Version must come after the one the link was made on (unlink it otherwise). Needs write rights on the model.
| Operation | EndLink · POST /openapi/linkeddata/EndLink |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
endLinkRequest | EndLinkRequestrequired | The request: its properties are those of the model, its JSON that of EndLink's request body. |
Returns#
LinkedDataLinkResult — The link with its trail
Example#
import { AuthApi, Configuration, EndLinkRequestFromJSON, LinkedDataApi, LinkedDataLinkResultToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = EndLinkRequestFromJSON({
"link_uuid": "00000000-0000-0000-0000-000000000000",
"from_version_uuid": "00000000-0000-0000-0000-000000000000"
});
// 3. The call
const result = await new LinkedDataApi(client).endLink({ endLinkRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataLinkResultToJSON(result), null, 2));getLinkedData#
getLinkedData(requestParameters: { getLinkedDataRequest: GetLinkedDataRequest }): Promise<LinkedDataDetails>One item with its links and their trail across Versions. The item with every field, the links on the models the caller can read, and per link the spans of Versions it was followed over, oldest first. A deleted item is answered too, so it can be restored. With version_uuid the model is followed up to that Version first. replaces and replaced_by name the items of a replacement (ReplaceLinkedData), both ways.
| Operation | GetLinkedData · POST /openapi/linkeddata/GetLinkedData |
|---|---|
| Scope | links:read |
Parameters#
| Name | Type | Description |
|---|---|---|
getLinkedDataRequest | GetLinkedDataRequestrequired | The request: its properties are those of the model, its JSON that of GetLinkedData's request body. |
Returns#
LinkedDataDetails — The item, its links and its replacements
Example#
import { AuthApi, Configuration, GetLinkedDataRequestFromJSON, LinkedDataApi, LinkedDataDetailsToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = GetLinkedDataRequestFromJSON({
"item_uuid": "00000000-0000-0000-0000-000000000000",
"version_uuid": "<version uuid of the first demo model>"
});
// 3. The call
const result = await new LinkedDataApi(client).getLinkedData({ getLinkedDataRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataDetailsToJSON(result), null, 2));getLinkedDataCounts#
getLinkedDataCounts(requestParameters: { getLinkedDataCountsRequest: GetLinkedDataCountsRequest }): Promise<LinkedDataCounts>Which objects of a Version have linked data. For colouring and markers in a viewer. What is on an object is what ListLinkedData shows there. The objects, those with a link to check, the objects per file family, one marker per object (its item count, the family most of its items have) and the Version's totals. include_later adds the objects whose only links were made on later Versions (later), never counted in the totals. Needs read rights on the model.
| Operation | GetLinkedDataCounts · POST /openapi/linkeddata/GetLinkedDataCounts |
|---|---|
| Scope | links:read |
Parameters#
| Name | Type | Description |
|---|---|---|
getLinkedDataCountsRequest | GetLinkedDataCountsRequestrequired | The request: its properties are those of the model, its JSON that of GetLinkedDataCounts's request body. |
Returns#
LinkedDataCounts — The objects with linked data
Example#
import { AuthApi, Configuration, GetLinkedDataCountsRequestFromJSON, LinkedDataApi, LinkedDataCountsToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = GetLinkedDataCountsRequestFromJSON({
"version_uuid": "<version uuid of the first demo model>",
"include_later": false
});
// 3. The call
const result = await new LinkedDataApi(client).getLinkedDataCounts({ getLinkedDataCountsRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataCountsToJSON(result), null, 2));getLinkedDataPolicy#
getLinkedDataPolicy(): Promise<LinkedDataPolicy>What this server accepts as linked data. The file families with their allowed extensions, the extensions that are never accepted, the limits, the categories, the identifier systems and the URL schemes of this server. A client builds its file picker and its messages from it, so a file that would be refused is explained before it is sent.
| Operation | GetLinkedDataPolicy · POST /openapi/linkeddata/GetLinkedDataPolicy |
|---|---|
| Scope | links:read |
Parameters#
None: the operation takes no request.
Returns#
LinkedDataPolicy — The policy
Example#
import { AuthApi, Configuration, LinkedDataApi, LinkedDataPolicyToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
// (GetLinkedDataPolicy takes no request)
// 3. The call
const result = await new LinkedDataApi(client).getLinkedDataPolicy();
// 4. The result
console.log(JSON.stringify(LinkedDataPolicyToJSON(result), null, 2));linkData#
linkData(requestParameters: { request: string; file?: Array<Blob> }): Promise<LinkDataResult>Link files, URLs, texts or identifiers to objects of a Version. Creates one item per entry of items in the JSON request part and links each item to every target. The files are the file parts, in the order of the items entries whose kind is FILE (an entry may name its part by position with stream instead); an entry without a filename takes the part's file name. No new Version is made: each link follows its object to the later Versions of the model.
| Operation | LinkData · POST /openapi/linkeddata/LinkData |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
request | stringrequired | A JSON-encoded LinkDataSpec (version_uuid, targets, items) |
file | Array<Blob>optional | The files, in the order of the FILE items |
Returns#
LinkDataResult — One entry per item, linked or refused
Example#
import { AuthApi, Configuration, LinkDataResultToJSON, LinkedDataApi } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = { request: JSON.stringify({"version_uuid":"<version uuid of the first demo model>","targets":[{}],"items":[{"kind":"URL"}]}) };
// 3. The call
const result = await new LinkedDataApi(client).linkData(request);
// 4. The result
console.log(JSON.stringify(LinkDataResultToJSON(result), null, 2));listLinkedData#
listLinkedData(requestParameters: { listLinkedDataRequest: ListLinkedDataRequest }): Promise<LinkedDataList>The linked data on a Version. Every link shown on the Version, or only those on some objects, with the items they link. The links of the model are followed up to the Version first, so the answer is never out of date. items holds each item once; links one entry per object, with oid_here, how the link was found there (how) and its state.
| Operation | ListLinkedData · POST /openapi/linkeddata/ListLinkedData |
|---|---|
| Scope | links:read |
Parameters#
| Name | Type | Description |
|---|---|---|
listLinkedDataRequest | ListLinkedDataRequestrequired | The request: its properties are those of the model, its JSON that of ListLinkedData's request body. |
Returns#
LinkedDataList — The items and the links on the Version
Example#
import { AuthApi, Configuration, LinkedDataApi, LinkedDataListToJSON, ListLinkedDataRequestFromJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = ListLinkedDataRequestFromJSON({
"version_uuid": "<version uuid of the first demo model>",
"oids": [
0
],
"qids": [
""
],
"include_orphaned": false,
"include_deleted": false,
"with_objects": false,
"include_later": false,
"kinds": [
"URL"
],
"categories": [
""
]
});
// 3. The call
const result = await new LinkedDataApi(client).listLinkedData({ listLinkedDataRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataListToJSON(result), null, 2));reattachLink#
reattachLink(requestParameters: { reattachLinkRequest: ReattachLinkRequest }): Promise<LinkedDataLinkResult>Put a link on another object from a Version on. The older Versions keep the object they had. From version_uuid on the link is on target (REATTACHED, OK), follows that object's GlobalId to later uploads, and the newer Versions are followed again from there. On the Version the link was made on, it corrects the object the link was made on. Needs write rights on the model.
| Operation | ReattachLink · POST /openapi/linkeddata/ReattachLink |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
reattachLinkRequest | ReattachLinkRequestrequired | The request: its properties are those of the model, its JSON that of ReattachLink's request body. |
Returns#
LinkedDataLinkResult — The link with its trail
Example#
import { AuthApi, Configuration, LinkedDataApi, LinkedDataLinkResultToJSON, ReattachLinkRequestFromJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = ReattachLinkRequestFromJSON({
"link_uuid": "00000000-0000-0000-0000-000000000000",
"version_uuid": "<version uuid of the first demo model>",
"target": {}
});
// 3. The call
const result = await new LinkedDataApi(client).reattachLink({ reattachLinkRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataLinkResultToJSON(result), null, 2));replaceLinkedData#
replaceLinkedData(requestParameters: { request: string; file?: Blob }): Promise<ReplaceLinkedDataResult>Replace an item from a Version on. A new datasheet for a pump that was swapped in v12: one call adds the new item (item of the JSON request part, as an item of LinkData; a FILE is the file part), linked from from_version_uuid on to the objects the old item is on there, and ends the old item's links from that Version, so the older Versions keep the old one. A link the old item got on that very Version is taken off (unlinked), and when that was all of the old item, it is deleted (deleted, restorable). The new item names the one it replaces (replaces_item_uuid; GetLinkedData answers both ways). Only the links on the model of from_version_uuid are replaced. Needs write rights on the model.
| Operation | ReplaceLinkedData · POST /openapi/linkeddata/ReplaceLinkedData |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
request | stringrequired | A JSON-encoded ReplaceLinkedDataSpec (item_uuid, from_version_uuid, item) |
file | Bloboptional | The file. The new file, when the new item is a FILE |
Returns#
ReplaceLinkedDataResult — The new item and its links, and what happened to the old one's
Example#
import { openAsBlob } from "node:fs";
import { AuthApi, Configuration, LinkedDataApi, ReplaceLinkedDataResultToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = { request: JSON.stringify({"item_uuid":"00000000-0000-0000-0000-000000000000","from_version_uuid":"00000000-0000-0000-0000-000000000000","item":{"kind":"URL"}}), file: new File([await openAsBlob("drawing.pdf")], "drawing.pdf") };
// 3. The call
const result = await new LinkedDataApi(client).replaceLinkedData(request);
// 4. The result
console.log(JSON.stringify(ReplaceLinkedDataResultToJSON(result), null, 2));restoreLinkedData#
restoreLinkedData(requestParameters: { restoreLinkedDataRequest: RestoreLinkedDataRequest }): Promise<RestoreLinkedDataResult>Bring deleted items back. Their links were kept; they show again where they were. 410 RETENTION_PASSED when an item was deleted longer ago than the retention period. Needs write rights on the item's model.
| Operation | RestoreLinkedData · POST /openapi/linkeddata/RestoreLinkedData |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
restoreLinkedDataRequest | RestoreLinkedDataRequestrequired | The request: its properties are those of the model, its JSON that of RestoreLinkedData's request body. |
Returns#
RestoreLinkedDataResult — The items restored
Example#
import { AuthApi, Configuration, LinkedDataApi, RestoreLinkedDataRequestFromJSON, RestoreLinkedDataResultToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = RestoreLinkedDataRequestFromJSON({
"item_uuids": [
"00000000-0000-0000-0000-000000000000"
]
});
// 3. The call
const result = await new LinkedDataApi(client).restoreLinkedData({ restoreLinkedDataRequest: request });
// 4. The result
console.log(JSON.stringify(RestoreLinkedDataResultToJSON(result), null, 2));unlinkData#
unlinkData(requestParameters: { unlinkDataRequest: UnlinkDataRequest }): Promise<UnlinkDataResult>Take links off their objects, on every Version. An item that would lose its last link is deleted instead (it can be restored, back on that object). Needs write rights on each link's model; nothing is changed when one is refused.
| Operation | UnlinkData · POST /openapi/linkeddata/UnlinkData |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
unlinkDataRequest | UnlinkDataRequestrequired | The request: its properties are those of the model, its JSON that of UnlinkData's request body. |
Returns#
UnlinkDataResult — The links taken off, and the items deleted because they lost their last link
Example#
import { AuthApi, Configuration, LinkedDataApi, UnlinkDataRequestFromJSON, UnlinkDataResultToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = UnlinkDataRequestFromJSON({
"link_uuids": [
"00000000-0000-0000-0000-000000000000"
]
});
// 3. The call
const result = await new LinkedDataApi(client).unlinkData({ unlinkDataRequest: request });
// 4. The result
console.log(JSON.stringify(UnlinkDataResultToJSON(result), null, 2));updateLinkedData#
updateLinkedData(requestParameters: { updateLinkedDataRequest: UpdateLinkedDataRequest }): Promise<LinkedDataItem>Edit the title, description, category, validity or identifier system of an item. The content never changes; a new file is a new item. Send the row_version you read; a stale one answers 409 VERSION_CONFLICT, naming who changed the item. An absent field keeps its value, an empty string clears it (the title falls back to the file name). Needs write rights on the item's model.
| Operation | UpdateLinkedData · POST /openapi/linkeddata/UpdateLinkedData |
|---|---|
| Scope | links:write |
Parameters#
| Name | Type | Description |
|---|---|---|
updateLinkedDataRequest | UpdateLinkedDataRequestrequired | The request: its properties are those of the model, its JSON that of UpdateLinkedData's request body. |
Returns#
LinkedDataItem — The item as it is now
Example#
import { AuthApi, Configuration, LinkedDataApi, LinkedDataItemToJSON, UpdateLinkedDataRequestFromJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = UpdateLinkedDataRequestFromJSON({
"item_uuid": "00000000-0000-0000-0000-000000000000",
"row_version": 0,
"title": "",
"description": "",
"category": "",
"valid_until": "",
"identifier_system": ""
});
// 3. The call
const result = await new LinkedDataApi(client).updateLinkedData({ updateLinkedDataRequest: request });
// 4. The result
console.log(JSON.stringify(LinkedDataItemToJSON(result), null, 2));