Closed droid-sheep closed 5 days ago
These are all present for me after installing. Try running pfsense-restapi buildendpoints
from the command line to force the endpoints to be rebuilt.
When i execute your mentioned command in the web debug command line i get this response:
Building endpoints...
Fatal error: Uncaught RESTAPI\Responses\ServerError: Cannot parse FloatField `cpu_load_avg` from internal because its internal value is not
a numeric value. Consider changing this field to a StringField. in /usr/local/pkg/RESTAPI/Fields/FloatField.inc:143
Stack trace:
#0 /usr/local/pkg/RESTAPI/Core/Field.inc(886): RESTAPI\Fields\FloatField->_from_internal('0,18 0,22 0,23')
#1 /usr/local/pkg/RESTAPI/Core/Model.inc(827): RESTAPI\Core\Field->from_internal('0,18 0,22 0,23')
#2 /usr/local/pkg/RESTAPI/Core/Model.inc(810): RESTAPI\Core\Model->from_internal_object(Array)
#3 /usr/local/pkg/RESTAPI/Core/Model.inc(354): RESTAPI\Core\Model->from_internal()
#4 /usr/local/pkg/RESTAPI/Core/Model.inc(296): RESTAPI\Core\Model->construct_from_internal(NULL, NULL)
#5 /usr/local/pkg/RESTAPI/Models/SystemStatus.inc(162): RESTAPI\Core\Model->__construct(NULL, NULL, Array)
#6 /usr/local/pkg/RESTAPI/Core/Endpoint.inc(272): RESTAPI\Models\SystemStatus->__construct()
#7 /usr/local/pkg/RESTAPI/Endpoints/StatusSystemEndpoint.inc(21): RESTAPI\Core\Endpoint->__construct()
#8 /usr/local/pkg/RESTAPI/.resources/scripts/manage.php(40): RESTAPI\Endpoints\StatusSystemEndpoint->__construct()
#9 /usr/local/pkg/RESTAPI/.resources/scripts/manage.php(412): build_endpoints()
#10 {main}
thrown in /usr/local/pkg/RESTAPI/Fields/FloatField.inc on line 143
PHP ERROR: Type: 1, File: /usr/local/pkg/RESTAPI/Fields/FloatField.inc, Line: 143, Message: Uncaught RESTAPI\Responses\ServerError: Cannot parse FloatField `cpu_load_avg` from internal because its internal value is not
a numeric value. Consider changing this field to a StringField. in /usr/local/pkg/RESTAPI/Fields/FloatField.inc:143
Stack trace:
#0 /usr/local/pkg/RESTAPI/Core/Field.inc(886): RESTAPI\Fields\FloatField->_from_internal('0,18 0,22 0,23')
#1 /usr/local/pkg/RESTAPI/Core/Model.inc(827): RESTAPI\Core\Field->from_internal('0,18 0,22 0,23')
#2 /usr/local/pkg/RESTAPI/Core/Model.inc(810): RESTAPI\Core\Model->from_internal_object(Array)
#3 /usr/local/pkg/RESTAPI/Core/Model.inc(354): RESTAPI\Core\Model->from_internal()
#4 /usr/local/pkg/RESTAPI/Core/Model.inc(296): RESTAPI\Core\Model->construct_from_internal(NULL, NULL)
#5 /usr/local/pkg/RESTAPI/Models/SystemStatus.inc(162): RESTAPI\Core\Model->__construct(NULL, NULL, Array)
#6 /usr/local/pkg/RESTAPI/Core/Endpoint.inc(272): RESTAPI\Models\SystemStatus->__construct()
#7 /usr/local/pkg/RESTAPI/Endpoints/StatusSystemEndpoint.inc(21): RESTAPI\Core\Endpoint->__construct()
#8 /usr/local/pkg/RESTAPI/.resources/scripts/manage.php(40): RESTAPI\Endpoints\StatusSystemEndpoint->__construct()
#9 /usr/local/pkg/RESTAPI/.resources/scripts/manage.php(412): build_endpoints()
#10 {main}
thrown
Also no change in the 404 Endpoints and still 404
@jaredhendrickson13
Okay now i found something! Executing the pfsense-restapi buildendpoints
command in the virtual machine shell gives me:
Building endpoints... done.
Building privileges... done.
After that (quick look) all endpoints work now. I don't know why the command doesn't work in the web debug shell. Also maybe there is a difference if i execute the install command in the web php prompt or in a "real" shell.
Maybe further investigate this or add an disclaimer to the install section that users shouldn't use the web debug shell.
I leave it up to you if you want to close this issue or investigate. Thank you for the rebuild command, it solved my issue.
Actually, the error you received previously does show a valid issue which could be preventing the endpoints from building correctly. The CPU load averages on your system are/were formatted with commas as the decimal separator instead of points as PHP expects them, which is valid for certain regions around the world. Regardless, the logic of the underlying models probably shouldn't prevent the endpoints from being built, so I'll work on a fix for those things.
Thanks!
Describe the bug
After freshly installing the pfrest pkg (pfSense-2.7.2-pkg-RESTAPI.pkg) some endpoint groups are not available (HTTP 404). Following groups of endpoints are not available (referencing https://pfrest.org/api-docs/#/):
To Reproduce Steps to reproduce the behavior:
pkg-static -C /dev/null add https://github.com/jaredhendrickson13/pfsense-api/releases/latest/download/pfSense-2.7.2-pkg-RESTAPI.pkg
Response:
Expected behavior Response defined in api docs and not a HTTP 404 error.
Screenshots or Response -/-
pfSense Version & Package Version:
Affected Endpoints:
Additional context -/-