Call: 1-888-779-3220
Receive a Quote Log In

Socialcast API

The Socialcast API:

Additional support is available by visiting the Socialcast Developer API forum

Methods

Messages API

Users API

Streams API

Groups API

Categories API

Content Filters API

Attachments API

Attachments API

Authentication API

Response Formats

Methods

Detailed instructions on the methods available with the Socialcast API and how to use them.

Messages API

Reading Stream Messages

Return the user's stream messages.

Request Type:

HTTP GET

Request Parameters:

Response

The JSON and XML formats of the stream have the structure outlined in Message List Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages.xml
    
ruby
      # 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
      // 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
      # 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
      // 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

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages.xml?since=1280587959
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Read a Single Stream Message

Return a specific message.

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a message have the structure outlined in Message Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/MESSAGE_ID.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Creating New Messages

Create a new message for the authenticated user.

Request Type:

HTTP POST

Request Parameters:

Response:

The JSON and XML formats of a message have the structure outlined in Message Response

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    
Post a new message with an attachment
      # 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
    

Updating Existing Messages

Update an existing message with new information. Only the message owner may update a message.

Request Type:

HTTP PUT

Request Parameters:

Response:

The JSON and XML formats of the returned message has the structure outlined in Message Response

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Destroy an existing message

Permanently remove a message from the system. Only message owners or community administrators are allowed to perform this operation.

Request Type:

HTTP DELETE

Request Parameters:

None

Response

An HTTP 200 response with an empty body.

Examples

Command Line Usage

bash
      # Curl Example
      curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/38.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Searching Messages

Search through all messages in your community.

Request Type:

HTTP GET

Request Parameters:

Response

The JSON and XML formats of the stream have the structure outlined in Message List Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/search.json?q=401k
    
ruby
      # 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
      // 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
      # 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
      // 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

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Likes API

Liking a Message

Add a like for the authenticated user for a particular message.

Request Type:

HTTP POST

Request Parameters:

None.

Response

The JSON and XML formats of a like have the structure outlined in Like Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/likes.xml
    
ruby
      # 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
      // 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
      # 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
      // 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-liking a Message

Un-like a message for the authenticated user.

Request Type:

HTTP DELETE

Request Parameters:

None

Response

The response will be an empty document with an HTTP status of 200.

Examples

Command Line Usage

bash
      # Curl Example
      curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/60/likes/12.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Comments API

Get a Comment

Lookup a particular comment.

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a comment have the structure outlined in Comment Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/387/comments/43.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Creating Comments

Create a new comment for an existing message.

Request Type:

HTTP POST

Request Parameters:

Response

The JSON and XML formats of a comment have the structure outlined in Comment Response

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    
Post a comment with an attachment
      # 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
    

Updating Comments

Update an existing comment on a message. Only the comment owner can perform this operation.

Request Type:

HTTP PUT

Request Parameters:

Response

The JSON and XML formats of a comment have the structure outlined in Comment Response

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Deleting a Comment

Delete a comment attached to a particular message. Only comment owners or community administrators are allowed to perform this operation.

Request Type:

HTTP DELETE

Request Parameters:

None

Response

An HTTP 200 response with an empty body.

Examples

Command Line Usage

bash
      # Curl Example
      curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/387/comments/43.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Comment Likes API

Liking a Comment

Add a like for the authenticated user for a particular comment.

Request Type:

HTTP POST

Request Parameters:

None.

Response

The JSON and XML formats of a like have the structure outlined in Like Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/comments/40/likes.xml
    
ruby
      # 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
      // 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
      # 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
      // 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-liking a Comment

Un-like a comment for the authenticated user.

Request Type:

HTTP DELETE

Request Parameters:

None

Response

The response will be an empty document with an HTTP status of 200.

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Flags API

Flag a Message

Add a flag for the authenticated user for a particular message.

Request Type:

HTTP POST

Request Parameters:

None.

Response

The JSON and XML formats of a like have the structure outlined in Flag Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/39/flags.xml
    
ruby
      # 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
      // 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
      # 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
      // 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

Un-flag a message for the authenticated user.

Request Type:

HTTP DELETE

Request Parameters:

None

Response

The response will be an empty document with an HTTP status of 200.

Examples

Command Line Usage

bash
      # Curl Example
      curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/messages/60/flags/123.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Users API

List all Active Users

Retrieve a paginated set of all active users in your community.

Request Type:

HTTP GET

Request Parameters:

Response

Paginated set of users. The JSON and XML formats of a like have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users.xml
    
ruby
      # 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
      // 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
      # 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
      // 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.

Request Type:

HTTP GET

Request Parameters:

Response

The JSON and XML formats of the stream have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/search.json?q=emily
    
ruby
      # 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
      // 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
      # 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
      // 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 User Profile

View information about a particular user.

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a like have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/25.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Update User Profile

Request Type:

HTTP PUT

Request Parameters:

See User Profile Response for available fields

Response

The JSON and XML formats of a like have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Deactivate User

Request Type:

HTTP DELETE

Request Parameters:

None

Response

The JSON and XML formats of a like have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/25.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Follow/Unfollow API

View List of Followers

return a paginated list of a user's followers

Request Type:

HTTP GET

Request Parameters:

Response

Paginated set of users. The JSON and XML formats of a like have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/followers.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Follow a User

Register the authenticated user as a follower.

Request Type:

HTTP POST

Request Parameters:

None.

Response

The JSON and XML formats of a like have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X POST -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/followers.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Un-Follow a User

Remove a following relationship for the authenticated user.

Request Type:

HTTP DELETE

Request Parameters:

None.

Response

empty response with an HTTP status code of 200.

Examples

Command Line Usage

bash
      # Curl Example
      curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/followers.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Following API

View List of Users Being Followed

return a paginated list of users that a user is currently following.

Request Type:

HTTP GET

Request Parameters:

Response

A paginated set of users. The JSON and XML formats of the stream have the structure outlined in User Profile Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/27/following.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Groups API

Listing Group Memberships

List all groups that the user is a member of.

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a like have the structure outlined in Group Membership Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/group_memberships.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Categories API

Listing Tenant Categories

Get a listing of all the categories from the current tenant

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a category have the structure outlined in Category List Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/categories.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Content Filters API

Listing Tenant Content Filters

Get a listing of all content filters associated to the current tenant

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a category have the structure outlined in Content Filter List Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/content_filters.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Streams API

Listing User's Streams

Get a listing of the streams that a user has.

Request Type:

HTTP GET

Request Parameters:

None.

Response

The JSON and XML formats of a stream has the structure outlined in Stream List Response

Examples

Command Line Usage

bash
      # Curl Example
      curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/streams.xml
    
ruby
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Attachments API

Creating Attachments

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.

Request Type:

HTTP POST

Request Parameters:

Response:

The XML and JSON format of the communities returned has the structure outlined in Attachment Response

Command Line Usage

bash
      # 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
      # 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

Authentication API

Retrieve list of Active Communities

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.

Request Type:

HTTP POST

Request Parameters:

Response:

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:

Authentication Error Codes:

The following error codes may be returned as part of an authentication failure response:

Examples

Command Line Usage

bash
      # 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
      # 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
      // 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
      # 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
      // 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();
        }
      }
    

Response Formats

Message List Response

Message Response

User Response

Group Response

Comment Response

Like Response

Flag Response

User Profile Response

Group Membership Response

Community List Response

Attachment Response

Category List Response

Content Filter List Response

Stream List Response

Standard Error Response