Additional support is available by visiting the Socialcast Developer API forum
Detailed instructions on the methods available with the Socialcast API and how to use them.
Return the user's stream messages.
HTTP GET
The JSON and XML formats of the stream have the structure outlined in Message List Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/messages.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/messages.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Messages since 2 hours ago
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages.xml?since=1280587959
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/messages.xml?since=1280587959')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages.xml?since=1280587959");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/messages.xml?since=1280587959';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages.xml?since=1280587959");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Return a specific message.
HTTP GET
None.
The JSON and XML formats of a message have the structure outlined in Message Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/MESSAGE_ID.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/messages/MESSAGE_ID.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/MESSAGE_ID.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/messages/MESSAGE_ID.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/MESSAGE_ID.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Create a new message for the authenticated user.
HTTP POST
The JSON and XML formats of a message have the structure outlined in Message Response
Command Line Usage
# Curl Example
curl -X POST -d "message[title]=trying%20out%20the%20api&message[body]=hello" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/messages.xml')
req.set_form_data({"message[title]"=>"trying out the api", "message[body]"=>"hello"}, ';')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "message[title]=trying%20out%20the%20api&message[body]=hello");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/messages.xml', ["message[title]"=>"trying out the api", "message[body]"=>"hello"];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "message[title]=trying%20out%20the%20api&message[body]=hello";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
# Curl Example
curl -X POST -d "message[attachments_attributes][0][uploaded_data]=@/path/to/my/file.jpg" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages.xml
Update an existing message with new information. Only the message owner may update a message.
HTTP PUT
The JSON and XML formats of the returned message has the structure outlined in Message Response
Command Line Usage
# Curl Example
curl -X PUT -d "message[title]=trying%20out%20the%20api%20by%20updating%20my%20sweet%20message&message[body]=hello%20updates" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/38.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Put.new('/api/messages/38.xml')
req.set_form_data({"message[title]"=>"trying out the api by updating my sweet message", "message[body]"=>"hello updates"}, ';')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/38.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_PUT, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "message[title]=trying%20out%20the%20api%20by%20updating%20my%20sweet%20message&message[body]=hello%20updates");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(PUT);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = PUT 'https://demo.socialcast.com/api/messages/38.xml', ["message[title]"=>"trying out the api by updating my sweet message", "message[body]"=>"hello updates"];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/38.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setDoOutput(true);
String data = "message[title]=trying%20out%20the%20api%20by%20updating%20my%20sweet%20message&message[body]=hello%20updates";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
Permanently remove a message from the system. Only message owners or community administrators are allowed to perform this operation.
HTTP DELETE
None
An HTTP 200 response with an empty body.
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/38.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/messages/38.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/38.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/messages/38.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/38.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Search through all messages in your community.
HTTP GET
The JSON and XML formats of the stream have the structure outlined in Message List Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/search.json?q=401k
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/messages/search.json?q=401k')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/search.json?q=401k");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/messages/search.json?q=401k';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/search.json?q=401k");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Messages since 2 hours ago
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/search.xml?q=a&since=1280587959
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/messages/search.xml?q=a&since=1280587959')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/search.xml?q=a&since=1280587959");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/messages/search.xml?q=a&since=1280587959';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/search.xml?q=a&since=1280587959");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Add a like for the authenticated user for a particular message.
HTTP POST
None.
The JSON and XML formats of a like have the structure outlined in Like Response
Command Line Usage
# Curl Example
curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/likes.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/messages/39/likes.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/39/likes.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/messages/39/likes.xml', [];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/39/likes.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
Un-like a message for the authenticated user.
HTTP DELETE
None
The response will be an empty document with an HTTP status of 200.
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/60/likes/12.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/messages/60/likes/12.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/60/likes/12.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/messages/60/likes/12.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/60/likes/12.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Lookup a particular comment.
HTTP GET
None.
The JSON and XML formats of a comment have the structure outlined in Comment Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/387/comments/43.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/messages/387/comments/43.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/387/comments/43.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/messages/387/comments/43.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/387/comments/43.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Create a new comment for an existing message.
HTTP POST
The JSON and XML formats of a comment have the structure outlined in Comment Response
Command Line Usage
# Curl Example
curl -X POST -d "comment[text]=a%20comment%20from%20the%20api" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/comments.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/messages/39/comments.xml')
req.set_form_data({"comment[text]"=>"a comment from the api"}, ';')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/39/comments.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "comment[text]=a%20comment%20from%20the%20api");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/messages/39/comments.xml', ["comment[text]"=>"a comment from the api"];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/39/comments.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "comment[text]=a%20comment%20from%20the%20api";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
# Curl Example
curl -X POST -d "comment[text]=here%20is%20my%20file&comment[attachments_attributes][0][uploaded_data]=@/path/to/my/file.jpg" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/comments.xml
Update an existing comment on a message. Only the comment owner can perform this operation.
HTTP PUT
The JSON and XML formats of a comment have the structure outlined in Comment Response
Command Line Usage
# Curl Example
curl -X PUT -d "comment[text]=an%20updated%20comment%20from%20the%20api" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/387/comments/43.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Put.new('/api/messages/387/comments/43.xml')
req.set_form_data({"comment[text]"=>"an updated comment from the api"}, ';')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/387/comments/43.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_PUT, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "comment[text]=an%20updated%20comment%20from%20the%20api");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(PUT);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = PUT 'https://demo.socialcast.com/api/messages/387/comments/43.xml', ["comment[text]"=>"an updated comment from the api"];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/387/comments/43.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setDoOutput(true);
String data = "comment[text]=an%20updated%20comment%20from%20the%20api";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
Delete a comment attached to a particular message. Only comment owners or community administrators are allowed to perform this operation.
HTTP DELETE
None
An HTTP 200 response with an empty body.
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/387/comments/43.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/messages/387/comments/43.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/387/comments/43.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/messages/387/comments/43.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/387/comments/43.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Add a like for the authenticated user for a particular comment.
HTTP POST
None.
The JSON and XML formats of a like have the structure outlined in Like Response
Command Line Usage
# Curl Example
curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/comments/40/likes.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/messages/39/comments/40/likes.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/39/comments/40/likes.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/messages/39/comments/40/likes.xml', [];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/39/comments/40/likes.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
Un-like a comment for the authenticated user.
HTTP DELETE
None
The response will be an empty document with an HTTP status of 200.
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/60/comments/70/likes/12.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/messages/60/comments/70/likes/12.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/60/comments/70/likes/12.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/messages/60/comments/70/likes/12.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/60/comments/70/likes/12.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Add a flag for the authenticated user for a particular message.
HTTP POST
None.
The JSON and XML formats of a like have the structure outlined in Flag Response
Command Line Usage
# Curl Example
curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/flags.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/messages/39/flags.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/39/flags.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/messages/39/flags.xml', [];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/39/flags.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
Un-flag a message for the authenticated user.
HTTP DELETE
None
The response will be an empty document with an HTTP status of 200.
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/60/flags/123.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/messages/60/flags/123.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages/60/flags/123.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/messages/60/flags/123.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/messages/60/flags/123.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Retrieve a paginated set of all active users in your community.
HTTP GET
Paginated set of users. The JSON and XML formats of a like have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/users.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/users.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Search through all users in your community.
HTTP GET
The JSON and XML formats of the stream have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/search.json?q=emily
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/users/search.json?q=emily')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/search.json?q=emily");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/users/search.json?q=emily';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/search.json?q=emily");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
View information about a particular user.
HTTP GET
None.
The JSON and XML formats of a like have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/25.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/users/25.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/25.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/users/25.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/25.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
HTTP PUT
See User Profile Response for available fields
The JSON and XML formats of a like have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X PUT -d "user[first_name]=Jennifer" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/25.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Put.new('/api/users/25.xml')
req.set_form_data({"user[first_name]"=>"Jennifer"}, ';')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/25.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_PUT, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user[first_name]=Jennifer");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(PUT);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = PUT 'https://demo.socialcast.com/api/users/25.xml', ["user[first_name]"=>"Jennifer"];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/25.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setDoOutput(true);
String data = "user[first_name]=Jennifer";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
HTTP DELETE
None
The JSON and XML formats of a like have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/25.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/users/25.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/25.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/users/25.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/25.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
return a paginated list of a user's followers
HTTP GET
Paginated set of users. The JSON and XML formats of a like have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/followers.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/users/27/followers.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/27/followers.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/users/27/followers.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/27/followers.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Register the authenticated user as a follower.
HTTP POST
None.
The JSON and XML formats of a like have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/followers.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/users/27/followers.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/27/followers.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/users/27/followers.xml', [];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/27/followers.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}
Remove a following relationship for the authenticated user.
HTTP DELETE
None.
empty response with an HTTP status code of 200.
Command Line Usage
# Curl Example
curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/followers.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Delete.new('/api/users/27/followers.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/27/followers.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, URLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(DELETE);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = DELETE 'https://demo.socialcast.com/api/users/27/followers.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/27/followers.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
return a paginated list of users that a user is currently following.
HTTP GET
A paginated set of users. The JSON and XML formats of the stream have the structure outlined in User Profile Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/following.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/users/27/following.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/users/27/following.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/users/27/following.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/users/27/following.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
List all groups that the user is a member of.
HTTP GET
None.
The JSON and XML formats of a like have the structure outlined in Group Membership Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/group_memberships.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/group_memberships.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/group_memberships.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/group_memberships.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/group_memberships.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Get a listing of all the categories from the current tenant
HTTP GET
None.
The JSON and XML formats of a category have the structure outlined in Category List Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/categories.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/categories.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/categories.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/categories.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/categories.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Get a listing of all content filters associated to the current tenant
HTTP GET
None.
The JSON and XML formats of a category have the structure outlined in Content Filter List Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/content_filters.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/content_filters.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/content_filters.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/content_filters.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/content_filters.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Get a listing of the streams that a user has.
HTTP GET
None.
The JSON and XML formats of a stream has the structure outlined in Stream List Response
Command Line Usage
# Curl Example
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/streams.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Get.new('/api/streams.xml')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/streams.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = GET 'https://demo.socialcast.com/api/streams.xml';
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/streams.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
}
}
Create a message attachment - limit 100MB.
Supports creating Attachments prior to a Create Message or Create Comment call, such as when there
is an upload widget which allows the user to complete file uploads before sending a message.
To connect your attachment to a message, send the id from the
Attachment Response
to the
Create Message
call.
Note that you can also create attachments directly as part of a Create Message call.
HTTP POST
The XML and JSON format of the communities returned has the structure outlined in Attachment Response
Command Line Usage
# Curl Example
curl -X POST -F "attachment=@/path/to/file.pdf" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/attachments.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
require 'rubygems'
require 'net/http/post/multipart' #see http://github.com/nicksieger/multipart-post
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post::Multipart.new "/api/attachments.xml", "attachment" => UploadIO.new("/path/to/file.pdf", "application/pdf")")
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
Users may have accounts in multiple communities and this API serves as a single entry point to determine the correct subdomain. Logging into the Socialcast Authentication API gives you access to the list of communities that the user is a member of.
POST requests to /api/authentication with basic auth credentials to determine if the user has correct credentials.
HTTP POST
The XML and JSON format of the communities returned has the structure outlined in Community List Response
Response for invalid credentials will have a 401 response code with the following structure:
The following error codes may be returned as part of an authentication failure response:
Command Line Usage
# Curl Example
curl -X POST -d "password=demo&email=emily@socialcast.com" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/authentication.xml
# Ruby example
require 'net/http'
require 'net/https'
require 'openssl'
https = Net::HTTP.new('demo.socialcast.com', 443)
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
https.use_ssl = true
response = ""
https.start do |session|
req = Net::HTTP::Post.new('/api/authentication.xml')
req.set_form_data({"password"=>"demo", "email"=>"emily@socialcast.com"}, ';')
req.basic_auth 'emily@socialcast.com', 'demo'
response = session.request(req).body
end
puts response
<?php
// PHP example
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/authentication.xml");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "password=demo&email=emily@socialcast.com");
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$api_return = curl_exec($ch);
echo $api_return;
// close cURL resource, and free up system resources
curl_close($ch);
?>
# Perl example
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Message;
use strict;
my $ua = LWP::UserAgent->new;
my $req = POST 'https://demo.socialcast.com/api/authentication.xml', ["password"=>"demo", "email"=>"emily@socialcast.com"];
$req->authorization_basic('emily@socialcast.com', 'demo');
my $response = $ua->request($req)->content;
print "$response";
// Java example
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.HttpURLConnection;
public class Api {
static final String kuser = "emily@socialcast.com";
static final String kpass = "demo";
static class SocialcastAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws java.net.MalformedURLException, java.io.IOException{
Authenticator.setDefault(new SocialcastAuthenticator());
URL url = new URL("https://demo.socialcast.com/api/authentication.xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
String data = "password=demo&email=emily@socialcast.com";
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write(data);
writer.flush();
InputStream ins = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String str;
while((str = reader.readLine()) != null)
System.out.println(str);
reader.close();
writer.close();
}
}