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

  1. Find the installation directory for Totalview and navigate to WCF\MobileWeb_*

  2. Open Totalview3WCF.exe.config

  3. Set the value attribute for the ExternalUsageAPIKey to a secure and unique string

    If ExternalUsageAPIKey is 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 email

  • StateID

  • Comment

  • StartTime - note: this field should be set to unix time in milliseconds

  • EndTime - note: this field should be set to unix time in milliseconds

Headers
  • x-api-key - This is the API key you specified in Totalview3WCF.exe.config as ExternalUsageAPIKey

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

../../_images/finding-user-details.png

Finding The StateID

  1. Open Totalview Admin

  2. Navigate to the state view

  3. Click on any of the states

    • The StateID is the first field called Id

    ../../_images/finding-state-id.png

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"
}