You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by Justin Engwer <ju...@mautobu.com> on 2021/08/30 23:35:25 UTC
API add connection
Hi,
I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone here
can give me a hand. I have a script for installing and configuring VNC on a
given domain PC. I'm currently attempting to write web requests to add a
new connection. I have authentication working, it's just the actual
creation of a new VNC connection that's broken. Keeps giving me error 500.
Any suggestions?
### Add connection to guacamole WIP
$pc = $args[0]
[Net.ServicePointManager]::SecurityProtocol =
[Net.SecurityProtocolType]::Tls12
# Obtain Token
$postParams = "username=api&password=aaaaaaa"
$t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens
-Method POST -Body $postParams|ConvertFrom-Json | select AuthToken
$token = $t.Authtoken
# test thing
$param = @{
parentIdentifier = "ROOT";
name = "aaaaaaaaaaaaaaa";
protocol = "vnc";
parameters = {
port = "5900";
password = "aaa";
hostname = "$pc"
}
}
$diet = $param | convertto-json
Invoke-WebRequest -Uri "
https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token"
-ContentType "application/json" -Method POST -Body $diet
# Deauthenticate token
Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token
-Method DELETE -Body "token=$token"
--
*Justin Engwer*
Re: API add connection
Posted by Justin Engwer <ju...@mautobu.com>.
Definitely syntax and powershell handling. Not really a guacamole problem,
but I figured I'd ask here. Matthieu suggested a powershell module which
looks super promising.
Justin
On Mon, Aug 30, 2021 at 4:48 PM James <jr...@gmail.com> wrote:
> Actually, just goto the ui, hit f12 then add the connection. You can see
> the body and uri passed in network. Probably just a syntax error
>
> On Mon, Aug 30, 2021, 6:42 PM James <jr...@gmail.com> wrote:
>
>> When I get to work tomorrow, I'll post the snippet you need.
>>
>> On Mon, Aug 30, 2021, 6:35 PM Justin Engwer <ju...@mautobu.com> wrote:
>>
>>> Hi,
>>> I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone
>>> here can give me a hand. I have a script for installing and configuring VNC
>>> on a given domain PC. I'm currently attempting to write web requests to add
>>> a new connection. I have authentication working, it's just the actual
>>> creation of a new VNC connection that's broken. Keeps giving me error 500.
>>> Any suggestions?
>>>
>>> ### Add connection to guacamole WIP
>>> $pc = $args[0]
>>> [Net.ServicePointManager]::SecurityProtocol =
>>> [Net.SecurityProtocolType]::Tls12
>>>
>>>
>>> # Obtain Token
>>> $postParams = "username=api&password=aaaaaaa"
>>> $t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens
>>> -Method POST -Body $postParams|ConvertFrom-Json | select AuthToken
>>> $token = $t.Authtoken
>>>
>>>
>>> # test thing
>>> $param = @{
>>> parentIdentifier = "ROOT";
>>> name = "aaaaaaaaaaaaaaa";
>>> protocol = "vnc";
>>> parameters = {
>>> port = "5900";
>>> password = "aaa";
>>> hostname = "$pc"
>>> }
>>> }
>>> $diet = $param | convertto-json
>>> Invoke-WebRequest -Uri "
>>> https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token"
>>> -ContentType "application/json" -Method POST -Body $diet
>>>
>>>
>>>
>>> # Deauthenticate token
>>> Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token
>>> -Method DELETE -Body "token=$token"
>>>
>>>
>>>
>>>
>>>
>>> --
>>>
>>> *Justin Engwer*
>>>
>>
--
*Justin Engwer*
Mautobu Business Services
250-415-3709
Re: API add connection
Posted by Justin Engwer <ju...@mautobu.com>.
Thanks. This is likely my best course of action. I'll ping back here if I
need more assistance.
On Mon, Aug 30, 2021 at 11:37 PM Matthieu Courtois <
courtois.matthieu.92@gmail.com> wrote:
> Hello,
>
>
>
> You can use my PowerShell module for this:
> https://github.com/UpperM/guacamole-powershell
>
>
>
> *De :* James <jr...@gmail.com>
> *Envoyé :* mardi 31 août 2021 01:48
> *À :* user@guacamole.apache.org
> *Objet :* Re: API add connection
>
>
>
> Actually, just goto the ui, hit f12 then add the connection. You can see
> the body and uri passed in network. Probably just a syntax error
>
>
>
> On Mon, Aug 30, 2021, 6:42 PM James <jr...@gmail.com> wrote:
>
> When I get to work tomorrow, I'll post the snippet you need.
>
>
>
> On Mon, Aug 30, 2021, 6:35 PM Justin Engwer <ju...@mautobu.com> wrote:
>
> Hi,
>
> I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone here
> can give me a hand. I have a script for installing and configuring VNC on a
> given domain PC. I'm currently attempting to write web requests to add a
> new connection. I have authentication working, it's just the actual
> creation of a new VNC connection that's broken. Keeps giving me error 500.
> Any suggestions?
>
>
>
> ### Add connection to guacamole WIP
>
> $pc = $args[0]
>
> [Net.ServicePointManager]::SecurityProtocol =
> [Net.SecurityProtocolType]::Tls12
>
>
>
> # Obtain Token
>
> $postParams = "username=api&password=aaaaaaa"
>
> $t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens
> -Method POST -Body $postParams|ConvertFrom-Json | select AuthToken
>
> $token = $t.Authtoken
>
>
>
> # test thing
>
> $param = @{
>
> parentIdentifier = "ROOT";
>
> name = "aaaaaaaaaaaaaaa";
>
> protocol = "vnc";
>
> parameters = {
>
> port = "5900";
>
> password = "aaa";
>
> hostname = "$pc"
>
> }
>
> }
>
> $diet = $param | convertto-json
>
> Invoke-WebRequest -Uri "
> https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token"
> -ContentType "application/json" -Method POST -Body $diet
>
>
>
> # Deauthenticate token
>
> Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token
> -Method DELETE -Body "token=$token"
>
>
>
>
>
>
>
>
> --
>
>
> *Justin Engwer*
>
>
--
*Justin Engwer*
Mautobu Business Services
250-415-3709
RE: API add connection
Posted by Matthieu Courtois <co...@gmail.com>.
Hello,
You can use my PowerShell module for this: https://github.com/UpperM/guacamole-powershell
De : James <jr...@gmail.com>
Envoyé : mardi 31 août 2021 01:48
À : user@guacamole.apache.org
Objet : Re: API add connection
Actually, just goto the ui, hit f12 then add the connection. You can see the body and uri passed in network. Probably just a syntax error
On Mon, Aug 30, 2021, 6:42 PM James <jrudley@gmail.com <ma...@gmail.com> > wrote:
When I get to work tomorrow, I'll post the snippet you need.
On Mon, Aug 30, 2021, 6:35 PM Justin Engwer <justin@mautobu.com <ma...@mautobu.com> > wrote:
Hi,
I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone here can give me a hand. I have a script for installing and configuring VNC on a given domain PC. I'm currently attempting to write web requests to add a new connection. I have authentication working, it's just the actual creation of a new VNC connection that's broken. Keeps giving me error 500. Any suggestions?
### Add connection to guacamole WIP
$pc = $args[0]
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Obtain Token
$postParams = "username=api&password=aaaaaaa"
$t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens -Method POST -Body $postParams|ConvertFrom-Json | select AuthToken
$token = $t.Authtoken
# test thing
$param = @{
parentIdentifier = "ROOT";
name = "aaaaaaaaaaaaaaa";
protocol = "vnc";
parameters = {
port = "5900";
password = "aaa";
hostname = "$pc"
}
}
$diet = $param | convertto-json
Invoke-WebRequest -Uri "https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token" -ContentType "application/json" -Method POST -Body $diet
# Deauthenticate token
Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token -Method DELETE -Body "token=$token"
--
Justin Engwer
Re: API add connection
Posted by James <jr...@gmail.com>.
Actually, just goto the ui, hit f12 then add the connection. You can see
the body and uri passed in network. Probably just a syntax error
On Mon, Aug 30, 2021, 6:42 PM James <jr...@gmail.com> wrote:
> When I get to work tomorrow, I'll post the snippet you need.
>
> On Mon, Aug 30, 2021, 6:35 PM Justin Engwer <ju...@mautobu.com> wrote:
>
>> Hi,
>> I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone
>> here can give me a hand. I have a script for installing and configuring VNC
>> on a given domain PC. I'm currently attempting to write web requests to add
>> a new connection. I have authentication working, it's just the actual
>> creation of a new VNC connection that's broken. Keeps giving me error 500.
>> Any suggestions?
>>
>> ### Add connection to guacamole WIP
>> $pc = $args[0]
>> [Net.ServicePointManager]::SecurityProtocol =
>> [Net.SecurityProtocolType]::Tls12
>>
>>
>> # Obtain Token
>> $postParams = "username=api&password=aaaaaaa"
>> $t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens
>> -Method POST -Body $postParams|ConvertFrom-Json | select AuthToken
>> $token = $t.Authtoken
>>
>>
>> # test thing
>> $param = @{
>> parentIdentifier = "ROOT";
>> name = "aaaaaaaaaaaaaaa";
>> protocol = "vnc";
>> parameters = {
>> port = "5900";
>> password = "aaa";
>> hostname = "$pc"
>> }
>> }
>> $diet = $param | convertto-json
>> Invoke-WebRequest -Uri "
>> https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token"
>> -ContentType "application/json" -Method POST -Body $diet
>>
>>
>>
>> # Deauthenticate token
>> Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token
>> -Method DELETE -Body "token=$token"
>>
>>
>>
>>
>>
>> --
>>
>> *Justin Engwer*
>>
>
Re: API add connection
Posted by James <jr...@gmail.com>.
When I get to work tomorrow, I'll post the snippet you need.
On Mon, Aug 30, 2021, 6:35 PM Justin Engwer <ju...@mautobu.com> wrote:
> Hi,
> I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone here
> can give me a hand. I have a script for installing and configuring VNC on a
> given domain PC. I'm currently attempting to write web requests to add a
> new connection. I have authentication working, it's just the actual
> creation of a new VNC connection that's broken. Keeps giving me error 500.
> Any suggestions?
>
> ### Add connection to guacamole WIP
> $pc = $args[0]
> [Net.ServicePointManager]::SecurityProtocol =
> [Net.SecurityProtocolType]::Tls12
>
>
> # Obtain Token
> $postParams = "username=api&password=aaaaaaa"
> $t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens
> -Method POST -Body $postParams|ConvertFrom-Json | select AuthToken
> $token = $t.Authtoken
>
>
> # test thing
> $param = @{
> parentIdentifier = "ROOT";
> name = "aaaaaaaaaaaaaaa";
> protocol = "vnc";
> parameters = {
> port = "5900";
> password = "aaa";
> hostname = "$pc"
> }
> }
> $diet = $param | convertto-json
> Invoke-WebRequest -Uri "
> https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token"
> -ContentType "application/json" -Method POST -Body $diet
>
>
>
> # Deauthenticate token
> Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token
> -Method DELETE -Body "token=$token"
>
>
>
>
>
> --
>
> *Justin Engwer*
>