Dynamic Batch QR Codes


Dynamic Batch QR enable the creation of multiple unique QR Codes against corresponding Assets. Dynamic Batch QR codes are useful when a series of unique QR Codes are required for a project. Check out the Tutorials section, where you will find example use cases where Dynamic Batch QR Code functionality is relevant.

Requirements

Create Multiple Assets with Unique Dynamic QR Codes

In the code below, we create three Assets representing billboards containing unique QR codes that redirect to the same website (intent). The Asset description contains information about these billboards, additionally, you could use location as a custom attribute of the Asset.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 // Obtain your projectId from CreateProject response const { projectId } = projectRes.project; async function main(){ // Create multiple assets that each represent a different billboard. // Each of these billboards will direct a user to the same listing at 123 Cherry Street. const createAssetsByProjectIdResponse = await os.project(projectId).assetsBatch().create([{ name: "Billboard 1", description: "Billboard at Yonge and Eglington for 123 Cherry Street Listing", customAttributes: { location: "yonge-eglinton", datePosted: "Oct 12, 2022", } qrCodes: [ { intent: "https://jaydeenrealty.com/123cherry/", intentType: "DYNAMIC_REDIRECT", }, ] },{ name: "Billboard 2", description: "Billboard at Yonge and Lawrence for 123 Cherry Street Listing", customAttributes: { location: "yonge-lawrence", datePosted: "Oct 12, 2022", } qrCodes: [ { intent: "https://jaydeenrealty.com/123cherry/", intentType: "DYNAMIC_REDIRECT", }, ] },{ name: "Billboard 3", description: "Billboard at Mt. Pleasant and Eglington for 123 Cherry Street Listing", customAttributes: { location: "mtpleasant-eglinton", datePosted: "Oct 12, 2022", } qrCodes: [ { intent: "https://jaydeenrealty.com/123cherry/", intentType: "DYNAMIC_REDIRECT" }, ] }]); console.log("Bulk Assets:", JSON.stringify(createAssetsByProjectIdResponse, "",2)); } main().catch((err) => { console.error(err); });
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 #Obtain your project_id from CreateProject response project_id = project_res.project.project_id create_assets_by_project_id_response = ospro.project(project_id).assets_batch().create([{ "name": "Billboard 1", "description": "Billboard at Yonge and Eglington for 123 Cherry Street Listing", "custom_attributes": { "location": "mtpleasant-eglinton", "date_posted": "Oct 12, 2022" }, "qr_codes": [{ "intent": "https://jaydeenrealty.com/123cherry/", "intent_type": "DYNAMIC_REDIRECT" }] }, { "name": "Billboard 2", "description": "Billboard at Yonge and Lawrence for 123 Cherry Street Listing", "custom_attributes": { "location": "mtpleasant-eglinton", "date_posted": "Oct 12, 2022" }, "qr_codes": [{ "intent": "https://jaydeenrealty.com/123cherry/", "intent_type": "DYNAMIC_REDIRECT" }] }, { "name": "Billboard 3", "description": "Billboard at Mt. Pleasant and Eglington for 123 Cherry Street Listing", "custom_attributes": { "location": "mtpleasant-eglinton", "date_posted": "Oct 12, 2022" }, "qr_codes": [{ "intent": "https://jaydeenrealty.com/123cherry/", "intent_type": "DYNAMIC_REDIRECT" }] }])

Congratulations! You just created your first batch of Openscreen dynamic QR codes!! 🥳

Assets contain a unique identifier assetId. This assetId can be used to create further Openscreen resources. You can obtain this assetId from the response of the CreateAssetsBulk endpoint used above:

1 const { assetId } = response.asset;
1 asset_id = response.asset.asset_id

Next Steps