Ever needed to have prognosis data visible to other applications? Prognosis allows other applications to request data using REST api.
1. Creating RESTful objects
In order to create objects for access via REST api, an admin needs to add PQL statements into "Prognosis\WebUI\IIS\Administration\Config\RestApiDataSets.xml" file. If it wasn't setup previously, you may not have a file, so just create a new file.
<dataSetCollection> <dataSet> <id>IdoftheRestObject</id> <query>SELECT * FROM PrognosisRecordName</query> </dataSet> </dataSetCollection>
query can be a select statement that is getting data directly from a prognosis record e.g: SELECT NodeName FROM PNODES
Or it can be selecting data from an existing 'PersistentView', e.g: SELECT * FROM Custom_User_PrognosisLicense
The advantage of using a persistentview is that data is readily available in memory and so response to rest query would be fast.
2. Adding Parameters to rest query.
Prognosis also allows to send parameters along with the request, so that you can apply filters and use same query object for different result set. E.g if we need a dataset, that returns cpu usage for a particular CPUNumber, we can define a dataset as: SELECT * FROM NTCPU WHERE CPUNumber = @CPUNumber
The above dataset now expects the caller to specify a value for CPUNumber when requesting data.
3. Accessing datasets through REST.
Accessing the data is easy. You need to be authenticated first. Prognosis can authorize either via cookie (if a user is already logged into webUI) or using basic authentication. Once authenticated, users can access datasets by url as:
https://localhost/Prognosis/Rest/v1/data/[Id] where Id is the name of the dataset.