It is helpful to have some additional tool that can capture network communication or/and make test request to rest api that you are trying to use. If this tool is not able to make successful request too then the problem is not with your code but rather with firewall or with rest api itself.
I personally use Fiddler and Postman for this purpose.
I use Postman myself, and it can fetch the details successfully. But with Pega I am unable to do so, for which we suspect that the firewall is blocking the communication. Still, I am doing further investigation to find the root cause.