Assets

Assets store information on a physical or digital object which in turn is usually represented by a QR Code. Assets allow you to organize your QR Codes in a Project.

Custom attributes allow you to add any additional information that you would like to be stored along with the asset. For example, in our real estate listing, we would like to include a custom attribute that has the listing ID of the property along with the type of listing (Sale vs Rental).

Note: The name of an Asset cannot be updated after creation.

Attributes

Get Assets By Account Id

Retrieves all assets linked to an Openscreen account. A valid accountId must be supplied in the request.

Returns

Returns a list of all Assets associated to an Openscreen accountId. Throws an error if the accountId is invalid.

1 const accountAssets = await os.account(accountId).assets().get();
{ "entityType": "get_assets_by_account_id.response_body", "accountId": "xxxxxxxxxxxxxx", "numberOfAssets": 4, "assets": [ { "entityType": "app.asset", "created": "2021-11-15T20:02:59.506Z", "modified": "2021-11-15T20:02:59.506Z", "assetId": "3226f712-3240-4398-85bd-448f203bb077", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "123Main Sign", "description": "Sign for 123 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } }, { "entityType": "app.asset", "created": "2021-11-15T20:06:22.163Z", "modified": "2021-11-15T20:06:22.164Z", "assetId": "5571a86c-aa8b-438d-9cae-78629b581c79", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "456Main Sign", "description": "Sign for 456 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } }, { "entityType": "app.asset", "created": "2021-11-15T20:04:29.348Z", "modified": "2021-11-15T20:04:29.348Z", "assetId": "97dfc80e-1bb8-4a34-8ec5-5c2b35ac126b", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "789Main Sign", "description": "Sign for 789 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } }, { "entityType": "app.asset", "created": "2021-11-15T20:05:07.287Z", "modified": "2021-11-15T20:05:07.287Z", "assetId": "f56c1cab-9343-487b-8fa5-145e539db6e9", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "901Main Sign", "description": "Sign for 901 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } } ] }

Delete Asset

Deletes an Asset. A unique assetId must be supplied in the request.

Returns

Returns the deleted Asset object. Throws an error if the assetId is invalid.

1 const deleteAsset = await os.asset(assetId).delete();
{ "entityType": "delete_asset.response_body", "asset": { "entityType": "app.asset", "created": "2021-11-29T14:09:56.000Z", "assetId": "a3c463a0-7038-41ec-bdef-2fab29c22cc5", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "name": "123Main Sign", "description": "Sign for 123 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } } }

Get Asset

Retrieves information for an Asset. A unique assetId must be supplied in the request.

QR code customization: Passing ImageOptions in this call will append to the existing customization of the QR code. In the example shown to the right, the background of the QR code will be changed to Black and the foreground changed to White. Any other customizations, including the logo in the QR code, will remain as-is. If no ImageOptions are specified, the QR code customizations remain unchanged.

Returns

Returns the Asset Object. Throws an error if the assetId is invalid.

1 2 3 4 5 6 const asset = await os.asset(assetId).get({ format: "PNG", scale: 12, background: "#FFFFFF", foreground: "#000000", });
{ "entityType": "get_asset.response_body", "assetId": "a3c463a0-7038-41ec-bdef-2fab29c22cc5", "asset": { "entityType": "app.asset", "assetId": "743bc3ce-7586-4774-bf9c-f29405b0f826", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "name": "123 Main Sign", "description": "Listing sign for 123 Main Street", "qrCodes": [ { "entityType": "app.qr-code", "assetId": "743bc3ce-7586-4774-bf9c-f29405b0f826", "qrCodeId": "c9f312bb-8168-407f-99fc-770160e6cf19", "status": "ACTIVE", "locatorKeyType": "SHORT_URL", "locatorKey": "qt_ry4_mm_sv3_", "intentType": "DYNAMIC_REDIRECT", "intent": "https://sidewalkqr.com/123main/", "scanCount": 0 "image": { "data": "data:image/png;base64,iVBORw0KG...", "options": { "scale": "12", "color": { "background": "#0a74b7", "foreground": "#ffffff" }, "dataUrl": "true", "format": "png" } }] } }

Get Asset History

Update Asset

Updates an existing Asset. This update clears the existing field and updates to the new inputted value.

Note: The name of an Asset cannot be updated after creation.

Request Object

Returns

Returns the updated Asset object. Throws an error if the assetId is invalid.

1 2 3 const asset = await os.asset(assetId).update({ description:'Listing SOLD' });
{ "entityType": "update_asset.response_body", "assetId": "a3c463a0-7038-41ec-bdef-2fab29c22cc5", "asset": { "entityType": "app.asset", "created": "2021-11-29T14:09:56.000Z", "assetId": "a3c463a0-7038-41ec-bdef-2fab29c22cc5", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "name": "123Main Sign", "description": "Listing SOLD", "customAttributes": { "type": "Sale", "MLS": "123ABC" } } }

Create Asset By Project Id

Creates a new Asset within a project. When creating an Asset, there is an option to also create QR Code(s) associated with the Asset. A unique assetId is returned once the Asset has been created.

Request Object

Returns

Returns a unique assetId for the newly created Asset. Throws an error if the projectId is invalid.

1 2 3 4 5 6 7 8 9 10 11 12 const asset = await os.project(projectId).assets().create({ name: '123Main Sign', description: 'Sign for 123 Main Street, Toronto', customAttributes: { type: 'Sale', MLS: '123ABC' }, qrCodes: [{ intent: 'https://sidewalkqr.com/123main', intentType: 'DYNAMIC_REDIRECT' }] });
{ "entityType": "create_asset_by_project_id.response_body", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "asset": { "entityType": "app.asset", "assetId": "a3c463a0-7038-41ec-bdef-2fab29c22cc5", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "name": "123Main Sign", "description": "Sign for 123 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" }, "qrCodes": [ { "entityType": "app.qr-code", "assetId": "a3c463a0-7038-41ec-bdef-2fab29c22cc5", "qrCodeId": "85d1cf38-846a-4816-80bb-fb7fff167004", "status": "ACTIVE", "locatorKeyType": "SHORT_URL", "locatorKey": "sP4axnyCfSV", "intentType": "DYNAMIC_REDIRECT", "intent": "https://sidewalkqr.com/123main", "scanCount": 0 } ] } }

Create Assets By Project Id

Creates Assets in bulk in a project. When creating Assets, there is an option to also create QR Code(s) associated with the Asset. This function accepts an array of Asset objects. When creating a QR Code with an Asset, an intent must be included upon creation. The QR Code that is generated will be returned within the Asset object.

Request Object

Returns

Returns a list of Assets including their unique assetId(s). Throws an error if the projectId is invalid.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 const bulkAssets = await os.project(projectId).assetsBatch().create([{ name: '123Main Sign', description: 'Listing sign for 123 Main Street', qrCodes: [ { intent: 'https://sidewalkqr.com/123main/', intentType: 'DYNAMIC_REDIRECT' }, ]}, { name: '456Main Sign', description: 'Listing sign for 456 Main Street', qrCodes: [ { intent: 'https://sidewalkqr.com/456main/', intentType: 'DYNAMIC_REDIRECT' }, ] }]);
{ "entitType": "create_assets_by_project_id.response_body", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "assets": [ { "entityType": "app.asset", "assetId": "743bc3ce-7586-4774-bf9c-f29405b0f826", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "name": 123 Main Sign", "description": "Listing sign for 123 Main Street", "qrCodes": [ { "entityType": "app.qr-code", "assetId": "743bc3ce-7586-4774-bf9c-f29405b0f826", "qrCodeId": "c9f312bb-8168-407f-99fc-770160e6cf19", "status": "ACTIVE", "locatorKeyType": "SHORT_URL", "locatorKey": "qt_ry4_mm_sv3_", "intentType": "DYNAMIC_REDIRECT", "intent": "https://sidewalkqr.com/123main/", "scanCount": 0 } ] }, { "assetId": "d9594047-ac41-445f-8867-81f8ccd60aca", "projectId": "a76adcf6-002d-40e0-b156-7f2e2d82733b", "name": "456 Main Sign", "description": "Listing sign for 456 Main Street", "qrCodes": [ { "entityType": "app.qr-code", "assetId": "d9594047-ac41-445f-8867-81f8ccd60aca", "qrCodeId": "841d1bc6-5bba-454f-be78-419e335376b0", "status": "ACTIVE", "locatorKey_type": "SHORT_URL", "locatorKey": "xxxxxxxx", "intentType": "DYNAMIC_REDIRECT", "intent": "https://sidewalkqr.com/456Main/", "scanCount": 0 } ] } ], "numberOfAssets": 2 }

Get Assets By Project Id

Retrieves Assets linked to a project. A valid projectId must be supplied in the request.

Returns

Returns a list of all Assets that are associated with the given projectId. Throws an error if the projectId is invalid.

1 const asset = await os.project(projectId).assets().get();
{ "entityType": "get_assets_by_project_id.response_body", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "numberOfAssets": 4, "assets": [ { "entityType": "app.asset", "created": "2021-11-15T20:02:59.506Z", "modified": "2021-11-15T20:02:59.506Z", "assetId": "3226f712-3240-4398-85bd-448f203bb077", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "123Main Sign", "description": "Sign for 123 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } }, { "entityType": "app.asset", "created": "2021-11-15T20:06:22.163Z", "modified": "2021-11-15T20:06:22.164Z", "assetId": "5571a86c-aa8b-438d-9cae-78629b581c79", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "456Main Sign", "description": "Sign for 456 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } }, { "entityType": "app.asset", "created": "2021-11-15T20:04:29.348Z", "modified": "2021-11-15T20:04:29.348Z", "assetId": "97dfc80e-1bb8-4a34-8ec5-5c2b35ac126b", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "789Main Sign", "description": "Sign for 789 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } }, { "entityType": "app.asset", "created": "2021-11-15T20:05:07.287Z", "modified": "2021-11-15T20:05:07.287Z", "assetId": "f56c1cab-9343-487b-8fa5-145e539db6e9", "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "901Main Sign", "description": "Sign for 901 Main Street, Toronto", "customAttributes": { "type": "Sale", "MLS": "123ABC" } } ] }