Users

This section of the API handles retrieval of user data. All requests must be authenticated as covered in the introduction.

smp.users.get

This method is used to get a specific user based on a unique ID. The following URL will get the user with the ID 127367.

http://playlists.net/api/v2?method=smp.user.get&id=127367

It will return an array of results similar to the following.

{
    "status":"ok",
    "user":{
        "id":"127367",
        "uri":"http:\/\/playlists.net\/members\/jessica-ransom",
        "display_name":"Jessica Ransom",
        "profile_image":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_l":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_m":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-medium\/default\/soundtrack.jpg",
        "profile_image_s":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-small\/default\/soundtrack.jpg"
    }
}

PHP SDK

require_once "ShareMyPlaylists.php";

$public = "{your_public_key}";
$private = "{your_private_key}";

$smp = new ShareMyPlaylists_Api($public, $private);

$parameters = array(
	"id" => 127367
);

$get_user = $smp->api("users.get", $parameters);

$user = $get_user["user"];

if( !empty($user) )
{
	print "".$user["display_name"]."";
}

smp.users.authorize

This method is used to sign a user into the service using the Playlists.net account.

http://playlists.net/api/v2?method=smp.user.authorise&email=email@example.com&password=examplepassword

The authorized user's details will be returned assuming the entered details are correct, otherwise an error will be returned.

{
    "status":"ok",
    "user":{
        "id":"127367",
        "uri":"http:\/\/playlists.net\/members\/jessica-ransom",
        "display_name":"Jessica Ransom",
        "profile_image":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_l":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_m":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-medium\/default\/soundtrack.jpg",
        "profile_image_s":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-small\/default\/soundtrack.jpg"
    }
}

PHP SDK

require_once "ShareMyPlaylists.php";

$public = "{your_public_key}";
$private = "{your_private_key}";

$smp = new ShareMyPlaylists_Api($public, $private);

$parameters = array(
	"email" => "email@example.com",
	"password" => "examplepassword"
);

$get_user = $smp->api("user.authorise", $parameters);

$user = $get_user["user"];

if( !empty($user) )
{
	print "".$user["display_name"]."";
}

smp.users.authoriseByTwitterId

This method is used to sign a user into the service using their Twitter account.

http://playlists.net/api/v2?method=smp.user.authoriseByTwitterId&twitter_id=34710860

The authorized user's details will be returned assuming the entered details are correct, otherwise an error will be returned.

Field
twitter_id The user's Twitter ID.
{
    "status":"ok",
    "user":{
        "id":"127367",
        "uri":"http:\/\/playlists.net\/members\/jessica-ransom",
        "display_name":"Jessica Ransom",
        "profile_image":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_l":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_m":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-medium\/default\/soundtrack.jpg",
        "profile_image_s":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-small\/default\/soundtrack.jpg"
    }
}

PHP SDK

require_once "ShareMyPlaylists.php";

$public = "{your_public_key}";
$private = "{your_private_key}";

$smp = new ShareMyPlaylists_Api($public, $private);

$parameters = array(
	"twitter_id" => 34710860
);

$get_user = $smp->api("user.authoriseByTwitterId", $parameters);

$user = $get_user["user"];

if( !empty($user) )
{
	print "".$user["display_name"]."";
}

smp.users.authoriseByFacebookId

This method is used to sign a user into the service using the Facebook account.

http://playlists.net/api/v2?method=smp.user.authoriseByFacebookId&facebook_id=34710860

The authorized user's details will be returned assuming the entered details are correct, otherwise an error will be returned.

Field
facebook_id The user's Facebook ID.
{
    "status":"ok",
    "user":{
        "id":"127367",
        "uri":"http:\/\/playlists.net\/members\/jessica-ransom",
        "display_name":"Jessica Ransom",
        "profile_image":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_l":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_m":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-medium\/default\/soundtrack.jpg",
        "profile_image_s":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-small\/default\/soundtrack.jpg"
    }
}

PHP SDK

require_once "ShareMyPlaylists.php";

$public = "{your_public_key}";
$private = "{your_private_key}";

$smp = new ShareMyPlaylists_Api($public, $private);

$parameters = array(
	"facebook_id" => 34710860
);

$get_user = $smp->api("user.authoriseByFacebookId", $parameters);

$user = $get_user["user"];

if( !empty($user) )
{
	print "".$user["display_name"]."";
}

smp.users.register

This method is used to sign a user up for a Playlists.net account.

http://playlists.net/api/v2?method=smp.user.register&display_name=Example&email=email@example.com&password=examplepassword

Field
display_name The user's chosen display name.
email The user's chosen email address.
password The user's chosen password.
facebook_id The user's Facebook ID.
facebook_access_token The user's Facebook access token.
twitter_id The user's Twitter ID.
twitter_oauth_token The user's Twitter oauth token.

The newsly registered user's details will be returned assuming the entered details are correct, otherwise an error will be returned.

{
    "status":"ok",
    "user":{
        "id":"127367",
        "uri":"http:\/\/playlists.net\/members\/jessica-ransom",
        "display_name":"Jessica Ransom",
        "profile_image":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_l":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-large\/default\/soundtrack.jpg",
        "profile_image_m":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-medium\/default\/soundtrack.jpg",
        "profile_image_s":"https:\/\/s3.amazonaws.com\/smpv2-users-profile_image-small\/default\/soundtrack.jpg"
    }
}

PHP SDK

require_once "ShareMyPlaylists.php";

$public = "{your_public_key}";
$private = "{your_private_key}";

$smp = new ShareMyPlaylists_Api($public, $private);

$parameters = array(
	"display_name" => "Example",
	"email" => "email@example.com",
	"password" => "examplepassword"
);

$get_user = $smp->api("user.register", $parameters);

$user = $get_user["user"];

if( !empty($user) )
{
	print "".$user["display_name"]."";
}