Skip to main content

4.1 – HTTP API

You can use HTTP request to create a server, symlink dynamically if you don't want to write a plug-in for the gateway.

To use the HTTP server, you’ll need to configure a password in gateway.conf:

Password = yourPassword

Then you can use MD5 hash of this password with the HTTP API.

Create servers on gateway:

http://gatewayAddress/SERVER?id=serverId&displayName=Name&server=hostName&gatewayPwd=passwordInGateway.conf&...

gatewayPwd is hexadecimal MD5 hash of the password which is configured in gateway.conf.

To delete a server add "&action=delete" to the URL; to update a server, add "&action=update" to the URL.

List servers:

http://w-think/SERVER?action=list&gatewayPwd=21232f297a57a5a743894a0e4a801fc3&id=ATPlus

It returns the asked server if id is specified:

{"id":"ATPlus","displayName":"ATPlus","server":"cloud.thinrdp.net","shadowing":false,"protocols":"rdp","icon":"kbd.png","rdp":{"username":"demo","password":"demo"}}

It returns all servers if id is not specified:

{
  "display" : true,
  "type" : "NORMALLIST",
  "cols" : [
    {"name" : "id"},
    {"name" : "displayName"},
    {"name" : "server"},
    {"name" : "remoteProgram"},
    {"name" : "command"}
  ],
  "rows" : [
    ["ATPlus", "ATPlus", "192.168.12.117", "", ""],
    ["WordPad", "WordPad", "192.168.0.118", "", "wordpad.exe"]
  ]
}

http://gatewayAddress/SYMLINK?symlink=symlinkId&server=existingServerId&validTime=20m&gatewayPwd=passwordInGateway.conf&...

You can also use "validFrom", "validTo" parameters. Please check http://www.remotespark.com/view/doc/com/toremote/gateway/connection/SymLink.html for more information.

To delete a symlink, add "&action=delete" to the URL; to update a symlink, add "&action=update" to the URL.

List symlinks:

http://w-think/SYMLINK?action=list&gatewayPwd=21232f297a57a5a743894a0e4a801fc3&symlink=212a155ee951-40db-95ea-177183174fa7

It returns the asked symlink if symlink is specified:

{"id":"212a155e-e951-40db-95ea-177183174fa7","resourceId":"169.254.146.243","validFrom":"Aug 26, 2015 12:00:00 AM","parameters":""}

It returns all the symlinks if symlink is not specified:

{
  "cols":[
    {"name":"id"},
    {"name":"resourceId"},
    {"name":"password"},
    {"name":"validFrom"},
    {"name":"validTime"},
    {"name":"validTo"},
    {"name":"parameters"},
    {"name":"comment"}
  ],
  "rows":[
    ["212a155e-e951-40db-95ea-177183174fa7", "169.254.146.243", "", 1440568800000, "", 0, "", ""],
    ["c5c6bc9d-f8a7-42ca-af9c-bd28c86adab4", "169.254.146.243", "", 1452544860000, "", 0, "", ""]
  ]
}

List sessions:

http://w-think/SESSION?action=list&gatewayPwd=21232f297a57a5a743894a0e4a801fc3&id=a29575a9-08c2-4162-9bfb-4876820953db

It returns the single session information if session id is specified:

{"id":"a29575a9-08c2-4162-9bfb4876820953db","server":"192.168.12.118","clientIp":"169.254.84.132","clientAgent":"Mozilla\/5.0 (Windows NT 10.0; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/47.0.2526.111 Safari\/537.36","thumbnail":"","startTime":"Tue Jan 26 15:38:55 MST 2016","numericId":621779525,"user":"","domain":"","rdpId":1,"startTime2":1453847935826}

It returns all sessions if session id is not specified:

{
  "cols":[
    {"name":"id"},
    {"name":"server"},
    {"name":"clientIp"},
    {"name":"clientAgent"},
    {"name":"startTime"},
    {"name":"numericId"},
    {"name":"user"},
    {"name":"domain"},
    {"name":"join"},
    {"name":"protocol"},
    {"name":"symlink"},
    {"name":"thumbnail"}
  ],
  "size":1,
  "rows":[
    ["a29575a9-08c2-4162-9bfb-4876820953db","192.168.12.118","169.254.84.132","Mozilla\/5.0 (Windows NT 10.0; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/47.0.2526.111 Safari\/537.36","Tue Jan 26 15:38:55 MST 2016",621779525,"","","","RDP","",""]
  ]
}

It returns multiple session information if ids parameter is used:

http://w-think/SESSION?action=list&gatewayPwd=21232f297a57a5a743894a0e4a801fc3&id=a29575a9-08c2-4162-9bfb-4876820953db&ids=sessinId1,sessionId2

[{session1}, {session2}]

Upload license file:

http://wthink/CONTROL?licenseFile=base64encodedLicenseFile&gatewayPwd=21232f297a57a5a743894a0e4a801fc3

Please make sure you encode the value of licenseFile. For example:

encodeURIComponent(base64encodedLicenseFile)

The new license file information will be returned in JSON format if the license file was uploaded successfully.

To query the current license file information, you can use:
http://w-think/CONTROL?licenseFile=.&gatewayPwd=21232f297a57a5a743894a0e4a801fc3

Get gateway information

http://w-think/CONTROL?target=gateway

{"version":"5.8.0","buildNumber":"941","buildTime":"2020_03_04_10","startTime":1583342850085}

Password is not needed for this gateway information request.

Reset Two Factor Authentication

http://w-think/CONTROL?target=twofa&user=Username&gatewayPwd=21232f297a57a5a743894a0e4a801fc3

curl -k -G --data-urlencode "target=twofa" --data-urlencode "user=svtest\user1" https://127.0.0.1/CONTROL

Error handling:

HTTP request will return HTTP Status code 500 and {"error:": "error information"} in JSON if there is an error. For example, server or symlink with specified id was not found when you try to get a server or symlink.

HTTP request will return status code 200 if operation succeeded.