How do I find specific resources?

Use ResourceLocatorUtil and its many dedicated methods

ResourceLocatorUtil has dedicated methods to get hold of different resources in Sitevision such as the Image Repository, the File Repository or the Trashcan. It also has methods to get a specific node by identifier, path or URL.

Step 1 - Get an instance of ResourceLocatorUtil

For WebApp/RESTApp 2; use import:

import resourceLocatorUtil from '@sitevision/api/server/ResourceLocatorUtil';

For Script module and WebApp/RESTApp 1; use require:

const resourceLocatorUtil = require('ResourceLocatorUtil');

Step 2 - Make use of the methods in ResourceLocatorUtil

// Get hold of the global File Repository
const fileRepository = resourceLocatorUtil.getFileRepository();

// Get hold of a specific node by its identifier
const article = resourceLocatorUtil.getNodeByIdentifier('5.196f6965181f1df20652f94');

// Get hold of the local Image Repository of a specific article
const localImageRepository = resourceLocatorUtil.getLocalImageRepository(article);

// Get hold of the Site Page
const sitePage = resourceLocatorUtil.getSitePage();

// Get hold of the Trashcan
const trashcan = resourceLocatorUtil.getTrashcan();

// Get hold of the Template Repository
const templateRepository = resourceLocatorUtil.getTemplateRepository();

// ...

Do you want to subscribe to News from Sitevision Developer team? Subscribe here!