Get the Instance Id
Version 1.6 by Vincent Massol on 2026/06/18 10:29
Content
Steps
To get the Instance Id, follow these steps:
- From Java:
- Get the InstanceIdManager:
@Inject private Provider<InstanceIdManager> idManagerProvider;Note the usage of a Provider. This is required only when the component in which you're injecting the Instance Id Manager is loaded before the XWiki Store has been initialized.
- Get the id:
The API is:
public interface InstanceIdManager { /** * @return the Instance id or null if it isn't set */ InstanceId getInstanceId(); }
- Get the InstanceIdManager:
- From a script in a wiki page:
- Get the id:
{{velocity}} $services.instance.getInstanceId() {{/velocity}}
- Get the id: