Current State Registration Endpoint¶
Note: When updating the WCF connector the configuration file will lose the ExternalUsageAPIKey value
Endpoint URL¶
[POST] https://[address]:[port]/rest/ExternalSetCurrentState
The endpoint supports both Totalview userid and email
Configuration¶
Configure The API Key In The WCF Config¶
Find the installation directory for Totalview and navigate to
WCF\MobileWeb_*Open
Totalview3WCF.exe.configSet the value attribute for the
ExternalUsageAPIKeyto a secure and unique stringIf
ExternalUsageAPIKeyis not present, you can add it yourself:<?xml version="1.0" encoding="utf-8"?> <configuration> ... <appSettings> <add key="ExternalUsageAPIKey" value=""/> </appSettings> ...
Calling The Endpoint¶
You will need to specify five parameters alongside a header:
- Parameters
UserID- note: this field can be set to a userid or emailStateIDCommentStartTime- note: this field should be set to unix time in millisecondsEndTime- note: this field should be set to unix time in milliseconds
- Headers
x-api-key- This is the API key you specified inTotalview3WCF.exe.configasExternalUsageAPIKey
Example of unix time in milliseconds
Unix time is defined as seconds since 1/1/1970
The date: 20/6/2022 11:07:01 AM in unix is 1655719621 that means 1655719621 seconds have passed since 1/1/1970
When sending requests to the ExternalSetCurrentState endpoint we want unix time passed in milliseconds that means we need to multiply the
unix time by 1000
That means 1655719621 should be passed as 1655719621000
Finding The UserID / Email Address¶
You can find a user’s UserID and Email by right-clicking on the user in the Totalview Client
Finding The StateID¶
Open Totalview Admin
Navigate to the state view
Click on any of the states
The
StateIDis the first field called Id
Example Calling The Endpoint Via cURL¶
curl --location --request POST 'https://[address]:[port]/rest/ExternalSetCurrentState' \
--header 'x-api-key: APIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"UserID":"test@domain.com",
"StateID":"In",
"Comment":"Production Support",
"StartDate": "/Date(1655363801000)/",
"EndDate": "/Date(1655394401000)/"
}'
Example of a successful call
{
"ExternalSetCurrentStateResult": {
"Error": "",
"Status": true
}
}
Example of a failed call
{
"ExceptionType": "InvalidStateID",
"Message": "No state found matching the StateId:In for userid:test@domain.com"
}
