API Connection woes

Hi all, recent TrueNAS convert here, running 24.04.1.1

I’m looking to use the REST API, specifically the filesystem/list_dir ones but I cannot get any valid response from the API. I have already created an API key in the GUI, to use as the bearer token.

But, testing from Postman, no matter what I try, the response is a white HTML page with a bouncing TrueNAS logo.

Tried again in PHP, and all POST requests get a 405 Not Allowed response, and GET requests get the HTML page.

This is a sample of the requests I have tried:

			CURLOPT_URL => 'https://myserver/api/2.0/device/get_info/',
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_ENCODING => '',
			CURLOPT_MAXREDIRS => 10,
			CURLOPT_TIMEOUT => 0,
			CURLOPT_SSL_VERIFYHOST =>false,
			CURLOPT_SSL_VERIFYPEER => false,
			CURLOPT_FOLLOWLOCATION => true,
			CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
			CURLOPT_CUSTOMREQUEST => 'POST',
			CURLOPT_POSTFIELDS =>'SERIAL',
			CURLOPT_HTTPHEADER => array(
				'Content-Type: application/json',
				'Authorization: Bearer 1-xxxxxxxxx'
			),

Any ideas? Does the API service need to be enabled somewhere before it can be used?

I am also seeing this issue, the REST api is basically unusable on SCALE :frowning:

I figured this out, at least for me. Swagger defaults to http://, even though I am running https:// and there is no way to change it, so it constantly fails.