Howen: How to generate the token
With Howen VSS (Video Service System), video streaming from Howen devices (MDVR) will be stored on Howen's VSS system. Within GpsGate, you can use click script to load and play all live and historical streams.
Requirements
- Enable ClickScripts in your application
- Enable Custom Fields for your application
- Download the full sample scripting package here.
Set up Device ID
On Howen's system, the API token can be requested every 30 mins. If you request the token too frequently, it will return an error message.
So, it's good to ask the system to auto-generate the token for each request.
Below, we will show you how to query the token every 30 minutes and save it in the custom field of the devices.
1. Set up a user custom field with the label Token.
2. Enable the Token custom field on the user type.
Set up timer click scripting
Go to Admin > Development > App Builder and create a new app. The name of the app can be anything you want.
4. Inside this new app, go to step 2. Click Scripts, and add a new Click Script.
5. Select Timer as its kind. Call it Generate_Token. Click Edit and add the following script:
var url = " https://YOUR_HOWEN_VSS_DOMAIN/vss/user/apiLogin.action";
var body = '{"username":"YOUR_USERNAME", "password":"YOUR_PASSWORD"}';
var ctype = 'application/json';
var head = 'Accept: application/json';
http.POST(url,ctype,head,body);
var result = JSON.parse(http.response);
result = result.data.token;
var t = tags.getTagByName("YOUR_HOWEN_DEVICE_TAG");
var devices = t.userIDs;
if(devices.length>0)
{
for(var i=0; i < devices.length; i++)
{
var a = directory.getUserByID(devices[i]);
a.setCustomFieldValue("Token",result);
}
}
log("Token Generated")
6. Test the script and check if the Token has been generated and saved on the devices.
7. Click on Save.
How to use the token
Your token is ready to use! The live and historical streams from Howen VSS are available within GpsGate.
Howen: How to display live-streaming video
Howen: How to display and playback historical streaming video