NAV
javascript php

SoclAll

Welcome to the SoclAll API! You can use our API to access SoclAll API endpoints, which can get connect your users to their social network accounts

Go to SoclAll and register an application for your website to get the app id and secret key

Settings

Name Description Example
domain Your site’s domain domain.com

Installation

Node.js

// Register app id and secret key
var SoclAll = require('soclall-api')
  , soclall = new SoclAll('app_id', 'secret_key');

Install from npm

npm install soclall-api --save

PHP

<?php
// Register app id and secret key
$soclall = new SoclAll('app_id', 'secret_key');
?>

Clone with git

https://github.com/sandklock/soclall-api-php

Authentication

// Get login url
var login_url = soclall.getLoginUrl('network', 'callback_url');
// Redirect user to login url
res.redirect(login_url);
<?php
// Get login url
$login_url = $soclall->getLoginUrl('network', 'callback_url');
// Redirect user to login url
header('Location: '.$login_url);
?>

Let user login and authenticate with your application.

HTTP REQUEST

REDIRECT https://api.soclall.com/login

Query Parameters

Parameter Value Description
app_id Your application’s id.
network network Network user want to connect.
callback Callback url to retrieve user’s token.

API

/user

// An user object returns in callback function
soclall.getUser('token', function(err, user){});
<?php
// Get user object
$user = $soclall->getUser('token');
?>

The user object returns JSON structured like this:

{
  // general
  "id": 2,
  "username": "Boy",
  "email": "boy@soclall.com",
  // name
  "full_name": "Boy Nguyen", // full name || first name + lastname
  "first_name": "Boy",
  "last_name": "Nguyen",
  "display_name": "Boy Boy", // Google Plus
  // profile
  "profile_url": "http://www.facebook.com/boy",
  "avatar_url": "",
  "avatar_small_url": "",
  "avatar_medium_url": "",
  "avatar_big_url": "",
  "gender": "", // male || female || unknown
  "date_of_birth": "", // YYYY/MM/DD
}

This endpoint retrieves user information.

HTTP Request

GET https://api.soclall.com/user

Query Parameters

Parameter Value Description
token User’s token

Response

Return an user object

/friends

// An array of user returns in callback function
soclall.getFriends('token', function(err, friends){});
<?php
// Get friend list
$friends = $soclall->getFriends('token');
?>

The friends object returns an array of user object like this:

[
  {
    "id": 2,
    "username": "Boy",
    "email": "boy@soclall.com",
    ...
  },
  {
    "id": 3,
    "username": "Girl",
    "email": "girl@soclall.com",
    ...
  }
]

This endpoint retrieves user’s friends.

HTTP Request

GET https://api.soclall.com/friends

URL Parameters

Parameter Value Description
token User’s token

Response

Return array of user objects

/message

// Send a message to friends
soclall.sendMessage('token', 'message', friend_ids, ['title',] function(err){});
<?php
// Send a message to friends
$soclall->sendMessage('token', 'message', $friend_ids, $title = '');
?>

This endpoint will send message to user’s friends.

HTTP Request

GET https://api.soclall.com/message

URL Parameters

Parameter Value Description
token User’s token
message Message content
friends List friend ids join by comma
title [optional] Title for LinkedIn and Tumblr

/publish

// Publish a message to wall/timeline/stream
soclall.publish('token', 'message', function(err){});
<?php
// Publish a message to wall/timeline/stream
$soclall->publish('token', 'message');
?>

This endpoint will publish a message to user’s wall/timeline/stream.

HTTP Request

GET https://api.soclall.com/publish

URL Parameters

Parameter Value Description
token User’s token
message Message

Networks

Network Code /user /friends /message /publish
Facebook facebook
Twitter twitter
Google Plus google
LinkedIn linkedin
Live live
Plurk plurk
Tumblr tumblr
Mail.ru mailru
Reddit reddit
Last.fm lastfm
Vkontakte vkontakte
Disqus disqus
Wordpress wordpress
Foursquare foursquare
Github github