I created a plug-in that retrieves data from an api(at least tries to!). This is the code of the function.
function call_back(){
$apiKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$response = wp_remote_get ('http://mysite.atlassian.net/rest/api/3/issue/LD-1',$args);
$args = array(
'headers' => array(
'Content-Type' => 'application/json',
'Authorization' => 'Basic ', $apiKey,
)
);
echo '<pre>';
var_dump(wp_remote_retrieve_body($response));
echo '</pre>';
};
The api key that i use works, used it in postman. But the problem i get is that in WP i get:
"string(95) "{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}""
I do have permission and the issue does exist, the problem is with authentication. For some reason i don't get access. Any idea on why?
$args
first