Sometimes we are getting an error saying "Client ID with <client id> not found". Is there any way to (programmatically)create a new client id and use it when the client is not found or expired?
ClientId is the unique identifier that a client (viewer) is assigned after the Register Client request - check HTML5 Report Viewer and Reporting REST services article. With this request the client session gets stored in the service cache. Upon client session expiration the experienced error will be thrown by the service.
Note that ClientSessionTimeOut property sets a value in minutes indicating how long a client (viewer) session will be preserved in the service storage after the last interaction initiated by this client. You may increase this value to avoid the error. Check also Error Client with ID 'xxxxxx-xxxx' not found. Expired troubleshoot article.
You may also refresh the viewer on a given interval or refresh the whole page to simulate interaction with the viewer.
If you repeat the Register Client request a new client will be registered. By default it will not be able to access the state (e.g. generated reports) of the previous client.