logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
paul@bluenetcloud.com  
#1 Posted : Friday, November 30, 2018 6:55:33 PM(UTC)
paul@bluenetcloud.com


Rank: Guest

Joined: 11/30/2018(UTC)
Posts: 4
United States
Location: Minnesota

I already tried browsing /OpenApiDocument.axd using a json viewer, but I can't seem to find it. (We are self-hosting)

I simply want a REST web API call to retrieve all the access hosts and their UID, so I can use it to add connection URLs to our tickets. (I don't use CW, I use CommitCRM)

Any documentation or help on how I could query the webapi to get this data?

Thanks!


paul@bluenetcloud.com  
#2 Posted : Wednesday, December 5, 2018 1:02:43 AM(UTC)
paul@bluenetcloud.com


Rank: Guest

Joined: 11/30/2018(UTC)
Posts: 4
United States
Location: Minnesota

I opened a ticket with support, they said to post here... Is there a way to get support for the REST API for ScreenConnect?

Scott  
#3 Posted : Friday, December 14, 2018 12:17:53 PM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,861
United States

Thanks: 3 times
Was thanked: 350 time(s) in 302 post(s)
As mentioned here we implement an OpenAPI document which can be retrieved similar to:

Code:

https://my.server.com:8040/OpenApiDocument.axd


You can also create an Extension that implements a WebService which can mutate/retrieve/modify whatever information you want which is reachable via webrequest. This KB article goes over that specific process a bit more.
ScreenConnect Team
paul@bluenetcloud.com  
#4 Posted : Monday, December 17, 2018 6:50:58 PM(UTC)
paul@bluenetcloud.com


Rank: Guest

Joined: 11/30/2018(UTC)
Posts: 4
United States
Location: Minnesota

Yup - I checked out the OpenApiDocument... I was pretty underwhelmed... I would certainly have thought that I was asking a pretty basic Inventory question that should be a no-brainer for any modern REST API, but that's doesn't seem to be the case here.

Creating a custom WebService extension is way more complex than I was looking for.. I'm NOT a programmer, which is why I was hoping to use the REST WebAPI (which is usually pretty simple to navigate and explore, in almost EVERY other vendor I've interfaced with). This one is not very easy to understand, and I find the documentation quite poor, which is why I came to the forum for help.

Can anyone provide an EXAMPLE of URL construction for a query to GET the Access hosts, and some identifiers (UID, and perhaps name, and some other basic identifying properties?)

I took the OpenApiDocument and put the JSON in a viewer, and I see no examples of a Service/PageService (is PageService where I should be looking?) that would show me some Access agent session information.

I tried to craft a query:
https://myschost.com/Ser...-info/GetHostSessionInfo
and the results are:
{"errorType":"ArgumentException","message":"Unable to convert arguments to corresponding parameter types: GetHostSessionInfo is not a valid value for SessionType.","detail":null}

Is this OpenApiDocument.axd the end-all-be-all of documentation... no other help, support or examples to help us get started?

I've found a FEW that work without parameters, so I know it is working:
https://myschost.com/Ser...ce.ashx/GetEligibleHosts
This returns some data... But I'm just left banging away trying to translate the JSON that is spit out of the OpenApiDocument, and that is very little to go on...
Scott  
#5 Posted : Tuesday, December 18, 2018 2:44:27 PM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,861
United States

Thanks: 3 times
Was thanked: 350 time(s) in 302 post(s)
Any request made to the ConnectWise Control server must be of type POST and have the following header:
Code:

Content-Type: application/json

For methods within the Services folder, authentication is expected and you can pass credentials as Basic Auth, among other possibilities common to .NET web applications.

Specifically for GetHostSessionInfo, the following request works for me:
https://my.screenconnect....ashx/GetHostSessionInfo

with the raw payload:
Code:

[2, [], null, null, 1000, 0]


returns the expected information for Access sessions.

To look into the payload a bit more there are 6 arguments as defined within the class that extends the WebServiceBase.
SessionType sessionType - either 0, 1, or 2 (Support, Meet, Access respectively)
string[] sessionGroupPath - typically the Session Group name (can be an Empty array for the root group)
string filter - used when searching for sessions via the Filter box at the top of the Host page
Guid? findSessionID - basically the same as filter but for the result
int sessionLimit - controls the number of sessions to display within the DOM for performance
long version - used to determine if groups should be recalculated/redisplayed

To step back, however, what exactly are you wanting to accomplish with the API?
ScreenConnect Team
paul@bluenetcloud.com  
#6 Posted : Tuesday, December 18, 2018 9:18:54 PM(UTC)
paul@bluenetcloud.com


Rank: Guest

Joined: 11/30/2018(UTC)
Posts: 4
United States
Location: Minnesota

I have an asset management and ticket management system. I am building automation to create tickets (tied to assets).

I want to track the UID of each unique asset in screen connect, so when I find a ticket with an asset, I can assemble and ADD the URL to directly connect to a remote session for that endpoint.

To that end I basically need to retrieve the FQDN of the endpoint and the Screen Connect unique identifier, then the ticket can get this posted into it:
https://myscreenconnect....-uid-for-this-asset/Join


SO I actually don't want SESSION info, but I want information about ALL the available ACCESS machines, and what their name is, and what their UID is.

Edited by user Tuesday, December 18, 2018 9:20:16 PM(UTC)  | Reason: Not specified

Scott  
#7 Posted : Tuesday, January 22, 2019 2:18:46 PM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,861
United States

Thanks: 3 times
Was thanked: 350 time(s) in 302 post(s)
In theory you could use the GetHostSessionInfo method within the PageService.ashx class for this but I think it would be more efficient to build an extension (more information on this process here. Your extension would contain two files:

Manifest.xml
Code:

<?xml version="1.0" encoding="utf-8"?>
<ExtensionManifest>
	<Version>1.0.0</Version>
	<Name>EXTENSION_NAME_HERE</Name>
	<Author>BlueNetCloud</Author>
	<ShortDescription></ShortDescription>
	<Components>
		<WebServiceReference SourceFile="Service.ashx" />
	</Components>
</ExtensionManifest>


Service.ashx
Code:

<%@ WebHandler Language="C#" Class="Service" %>

using System;
using System.Configuration;
using System.Web;
using System.Linq;
using ScreenConnect;
using System.Collections.Generic;

[DemandPermission(PermissionInfo.AdministerPermission)]
public class Service : WebServiceBase
{
	public object[] GetAccessSessionIDs() 
	{
		return SessionManagerPool.Demux.GetSessions()
			.Where(_ => _.SessionType == SessionType.Access)
			.Select(s => new{
				s.SessionID,
				s.Name
			}).ToArray();
	}
}


You would then invoke this method using Basic auth (because it's demanding the AdministerPermission) with something similar to:
Code:

https://my.screenconnect.com/App_Extensions/EXTENSION_ID/Service.ashx/GetAccessSessionIDs


And it would return a list of objects where each object contained the Name and SessionID for an Access session.
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.