guacamole-rest-api-documentation icon indicating copy to clipboard operation
guacamole-rest-api-documentation copied to clipboard

Generate token API throws 404 error

Open plrnr opened this issue 1 year ago • 2 comments

Hi,

Guacamole 1.4.0 version. I am using python requests to make API call to generate token which I plan to use to make other API calls.

>>> import requests
>>> payload = {'username': 'guacadmin', 'contentType': 'application/x-www-form-urlencoded', 'password': 'guacadmin', 'Content-type': 'application/x-www-form-urlencoded'}
url = 'http://127.0.0.1:8080/api/tokens'
>>> response = requests.post(url,data=payload)
>>> print(response.text)
<!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/8.5.73</h3></body></html>
>>> response.ok
False
>>> response.status_code
404

Any help is appreciated.

Thanks

plrnr avatar Jan 20 '23 20:01 plrnr

Have the same problem, did you manage to fix it?

image

brolifen avatar Jun 03 '23 21:06 brolifen

I shortly after discovered this is because the path should be api/tokens and not guacamole/api/tokens as the example page shows. Additionaly in form encode you have use = and not : which is for json encoding

image

brolifen avatar Jun 03 '23 22:06 brolifen