On Tue, Nov 15, 2022 at 12:03 PM Daniel Carroll
<[email protected]> wrote:
>
> Hi,
>
> I've been using Apache Guacamole for a while now and have had quite a bot of 
> success with it.
> Now I'm trying to use the Guacamole REST API to configure users and 
> connections.
> I'm able to successfully query the REST API for information, but now that I'm 
> trying to add/update information I'm not having any success.  Would anyone be 
> able to give me some pointers?
> I'm using the official Dockerized version of Apache Guacamole 1.4.0 from 
> DockerHub: https://hub.docker.com/r/guacamole/guacamole (and guacamole/guacd)
> This Github repository documents the REST API that I'm trying to follow: 
> https://github.com/ridvanaltun/guacamole-rest-api-documentation#api-ref
>

This is not an official Guacamole repository, but it's nice that
someone has taken a stab at this. There have been some efforts in the
past to try to programmatically document it - one of these days we'll
get that integrated into the project.

> When I attempt to create a new Guacamole connection, I receiving the 
> following generic error in the REST response:
>     Unexpected internal error
>
> I see the following in the Tomcat logs (via 'docker logs CONTAINERID'):
>   ...
>   15:57:19.557 [http-nio-8080-exec-3] ERROR o.a.g.rest.RESTExceptionMapper - 
> An internal error occurred, but did not contain an error message. Enable 
> debug-level logging for details.
>   15:57:19.559 [http-nio-8080-exec-3] DEBUG o.a.g.rest.RESTExceptionMapper - 
> Unexpected error in REST endpoint.
>   java.lang.NullPointerException: null
>           at 
> org.apache.guacamole.rest.directory.DirectoryObjectTranslator.filterAttributes(DirectoryObjectTranslator.java:145)
>           at 
> org.apache.guacamole.rest.connection.ConnectionObjectTranslator.filterExternalObject(ConnectionObjectTranslator.java:68)
>           ...
>
> I tried setting the LOGBACK_LEVEL environment variable to debug when creating 
> the docker instance and that did raise the logging level, but it hasn't 
> provided any insight into the unhelpful "An internal error occurred, but did 
> not contain an error message. Enable debug-level logging for details" message.
> Also, per 
> https://guacamole.apache.org/doc/gug/configuring-guacamole.html#webapp-logging
> I've edited logback.xml in the container and set: <appender name="GUAC-DEBUG" 
> ... </appender> <root level="debug"> <appender-ref ref="GUAC-DEBUG"/> </root>
> That didn't provide any additional logging information that I could see.
>
> I've also captured the contents of the POST to create the connection and it 
> looks kosher.  Here's roughly what it looks like (I've edited the token and 
> names):
>
>   POST /guacamole/api/session/data/mysql/connections?token=xxx...xxx HTTP/1.1
>   User-Agent: Faraday v0.14.0
>   Content-Type: application/json
>   Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
>   Accept: */*
>   Connection: close
>   Host: guac.my.dns.domain
>   Content-Length: 230
>
>   
> {"parentIdentifier":"ROOT","name":"XXXXX","protocol":"rdp","parameters":{"port":"3389","security":"nla","ignore-cert":"true","username":"${GUAC_USERNAME}","password":"${GUAC_PASSWORD}","hostname":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}
>
>
> Does anyone have any thoughts/suggestions as to what I need to do differently 
> to create connections using the REST API?

The most likely explanation is that the body is not formatted
correctly - either the JSON is bad, or something about the headers
isn't quite right. I'd suggest using the browser's Developer Tools to
capture output during creation with the Web interface, which will give
you the headers and body format that is required to correctly create
the connection, user, etc.

-Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to