Archive for the ‘SocialGo’ Category

SocialGo API

Thursday, February 18th, 2010

We’ll this post is for remembering one very important issue with the SocialGo API.

I was doing a webpage that send users to their SGo page. So I used the SGo API.

I downloaded it and realized that when you download the API the corresponding keys (developer and network) are already assigned to the corresponding properties so I was doing this:

$api = new SNM_api();

$id = 'test@example.com'; //. user email OR user ID
$result = $api->getUserCrossDomainAuthURL($id);
$redirect_user_url = $result->member->attributes()->auth_url;

I’ve been dealing with the fact that I kept getting false as a result… What’s wrong with the code?

So I went to the blogs, even the SocialGo blogs and some developers wrote me saying I needed to set the network and developer keys. I was reluctant because the object already had the pproperties set so I thought it was a silly answer, till minutes ago when I finally gave up trying other solutions. It worked! I haven’t takn a look to the SGo API but it looks that you need to set this properties in order for the API to work so the code ends up like this:

$api = new SNM_api();

$api->setApiServer('http://api.socialgo.com/');
$api->setNetworkKey('<NETWORK_KEY>');
$api->setDeveloperKey('<DEV_KEY>');

$id = 'test@example.com'; //. user email OR user ID
$result = $api->getUserCrossDomainAuthURL($id);
$redirect_user_url = $result->member->attributes()->auth_url;
I'll never forget about this again.