I'm trying to use the Docker API with Docker Desktop. Need help

Hello, I’m new to Docker. I’m trying to access the Docker API using Java, so I want to try running a curl command like “curl http://localhost/v1.45/containers/json”, but I’m not sure why it’s not working. I’m starting with the command line and will implement it in Java later.