Certificate error when trying to use example from REST API to get repos in workspace

I’m trying to use the PHP example for the GET /2.0/workspaces/{workspace}/projects endpoint.

I’ve installed Unirest, since it’s indicated that it’s required, but when I try to run my page I get an error message:

“Uncaught Unirest\Exception: SSL certificate problem: unable to get local issuer certificate in C:\repo\atlassianscripts\vendor\mashape\unirest-php\src\Unirest\Request.php:476”

I’m running a local instance of IIS that has a valid self-signed certificate, so I’m not sure what the problem is. I realize this isn’t specifically an Atlassian issue, but since the code sample is taken directly, I figured there might be someone here who’s run into this and solved it.

I did some googling and found that this seems to be a common problem when developing locally with Unirest.

This is the article I found Unirest for PHP SSL certificate problem: unable to get local issuer certificate | Our Code World

Thank you. That was one of the pages I saw when I searched for the error. However, disabling the verification isn’t something I want to do, since this code is going to be deployed to an actual remote server at some point and I don’t want to push code that I can’t test as is locally. I need a way to get unirest to recognize the self-signed certificate that IIS creates.

Unfortunately this is outside the expertise I can help you with here.

@EstherStrom,

If the problem is self-signing (which means you have to tell IIS about the signing authority), then you might use https://letsencrypt.org/ instead.

Thanks! I’m not familiar with that, but I’ll take a look.