Show App in IFrame session

If you have created a session with more than one app, and you don’t want to show the default DWService App bar (hideAppsBar=true), you can show, after an opened session, the App in the frame by calling dwsApiShowApp:

dwsApiShowApp(ifname, name)

  • iframe: ID of Iframe on your page
  • name: Name of App to show. (desktop, filesystem, terminal, etc…)

Close IFrame session

This function closes the session previously opened by dwsApiOpenIFrameSession:

dwsApiCloseIFrameSession(ifname)

  • iframe: ID of Iframe on your page

Open IFrame session

The API creates a session which returns a url that you can open inside an IFrame of your web page through this function:

dwsApiOpenIFrameSession(ifname, url, callback)

  • iframe: ID of Iframe on your page
  • url: url session to open
  • callback: event callback

The event callback must be only one parameters e.g.:

function(e){
...
}

It’s called when the user is connected to the agent or when user is disconnected from the agent.
e.type = identifies event type (CONNECTED or DISCONNECTED)
e.availableApps = lists of available apps ([desktop, filesystem, …]). It’s present only if type=CONNECTED

Develop the web application

In order to show correctly DWService content inside an IFrame, you have to include the following javascript library on your page:

<script src="https://www.apiremoteaccess.com/res/js/dwsapi.js" type="text/javascript">
</script>

This javascript code enables interaction between your application and DWService content. It works through the Cross-Domain Messaging (window.postMessage), so it’s important to set the property “postMessageOrigin” when you create a new session.

Close session

REQUEST
DELETE /id=<session id> or /idChannel=<channel id>

RESPONSE
200 OK
{
status: 200
}

Get session

REQUEST
GET /id=<session id> or /idChannel=<channel id>

RESPONSE
200 OK
{
id: xxxxxxxxxxxxxxxxx,
idChannel: xxx,
idAgent: xxxxxxxxxxxxxxxxx,
initTime: Fri Oct 19 15:19:48 UTC 2018,
frozen: false,
ipAddress: xxx.xxx.xxx.xx
}

List all sessions

REQUEST
GET

RESPONSE
200 OK
[
{
id: xxxxxxxxxxxxxxxxx,
idChannel: xxx,
idAgent: xxxxxxxxxxxxxxxxx,
initTime: Fri Oct 19 15:19:48 UTC 2018,
frozen: false,
ipAddress: xxx.xxx.xxx.xx
},
{
id: xxxxxxxxxxxxxxxxx,
idChannel: xxx,
initTime: Fri Oct 19 15:19:48 UTC 2018,
frozen: false,
ipAddress: xxx.xxx.xxx.xx
},
...
]

Create a new session

REQUEST
POST
{
idChannel: 0,
idAgent: xxxxxxxxxxxxxxxx
locale: en
fullAccess: false,
hideAppsBar: true,
postMessageOrigin: www.mysite.com,
applications: {
desktop: {
fullAccess: true,
},
filesystem: {
fullAccess: false,
paths: [
{
name: path1,
path: c:\\test,
edit: true,
download: true,
upload: true
},
...
],
...
},
...
}
}

RESPONSE
200 OK
{
idChannel: channel id (same of request),
url: url of session
tempcode: temporary code (present only if idAgent is empty).
}

The information to create a session is:

idChannel:Identify the channel id.
idAgent:Identify the agent id (if omitted, create a temporary session).
fullAccess:true or false
applications:List of application allowed. (Valid if fullAccess=false). The available applications are: desktop, filesystem, texteditor, resource, logwatch, shell
hideAppsBar:true/false (default false) hide menu apps.
showAppOnLoad:Show app specified when session is loaded. (valid only if you have defined more of one app in applications)
postMessageOrigin:If you want show content inside of IFrame you have to set your domain (e.g. https://www.company.com).

If fullAccess is false, you have to specify the list of allowed applications :

Desktop :

fullAccess:true or false
allowScreenInput:Allow user input. (Valid if fullAccess=false)
allowAudio:Allow remote audio. (Valid if fullAccess=false)
hideToolBar:Hide the toolbar. (true/false)
backgroundColor:Change background color. (e.g. "#ffffff")
messageBackgroundColor:Change message background color. (e.g. "#ffffff")
messageColor:Change message color. (e.g. "#000000")

FileSystem:

fullAccess:true or false
paths:Shows to user only specified path list.(Valid if fullAccess=false).
The path information are:
  • name: Name shown to the user.
  • path: The real directory path.
  • edit: Allow edit (true or false).
  • download: Allow download (true or false).
  • upload: (true or false).

TextEditor:

fullAccess:true or false
paths:Shows to user only specified path list. (Valid if fullAccess=false).
The path information are:
  • name: Name shown to the user.
  • path: The real directory path.
  • edit: Allow edit (true or false).

LogWatch:

fullAccess:true or false
paths:Shows to user only specified path list. (Valid if fullAccess=false).
The path information are:
  • name: Name shown to the user.
  • path: The real directory path.

Resource:

fullAccess:true

Shell:

fullAccess:true

Sessions resource

The url to perform operations on sessions resource is:

https://www.apiremoteaccess.com/en/api/json/sessions

This resource allows you to manage user sessions to agent. When you create a user session, the server returns a URL that you can publish inside the IFrame of your web application or you can open it in new window. Every user session is identified by unique IDChannel, if you create a new user session with IDChannel already connected, the previous session with same IDChannel will be closed.
The DELETE method allows you to close a session, but you don’t need to close the session by API because the correct way is to close the session is within your web application.

The session resource information is:

id:Identify the session id.
idChannel:Identify the channel id.
idAgent:Identify the agent id (if missing, is a temporary session).
initTime:UTC time when session is started.
ipAddress:IP address of the user.
frozen:true/false. After 20 minute of inactivity the session will be frozen. After 24 hours the session will be destroyed.
frozenTime:UTC time when session is frozen. (valid if frozen=true).

Get agent

REQUEST
GET /id=<agent id> or /name=<agent name>

RESPONSE
200 OK
{
state: N,
osType: 1,
id: xxxxxxxxxxxxxxxxxx,
supportedApplications: filesystem;texteditor;logwatch;resource;desktop,
description: Description,
name: Name
}