Here, I want to create circle in google plus using api. I got https://developers.google.com/+/domains/api/circles/insert link for creating circle. I did my code with perfect.
$headers = array
(
'Content-Type: application/json'
);
$ch = curl_init();
# Setup request to send json via POST.
$jsonData = json_encode( array( "displayName"=> "abc" ) );
//echo "https://www.googleapis.com/plusDomains/v1/people/".$socialuserId."/circles?access_token=".$accessToken;exit;
curl_setopt( $ch, CURLOPT_URL, "https://www.googleapis.com/plusDomains/v1/people/".$socialuserId."/circles?access_token=".$accessToken);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $jsonData );
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_POST, true );
# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
# Send request.
$result = curl_exec($ch);
curl_close($ch);
Here, $socialuserId
and $accessToken
I am getting right.
But I am getting Forbidden Error like below.
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
What can be the reason for this error? Thanks in advanced.