API Authentication

ProTexting Feed API requires authentication. Authentication by Developer API Key (access_token) is available. In order to use this method the access token should be appended to the requested URL as a get parameter.

API Host Address:

The Feed API Host Address is https://protexting.com/features/api

Request Operations

  • The requests are made using the application name, a method and additional arguments depending on the application. For example:
    https://protexting.com/features/api/<appname>/<method>/?args
    
  • The following code for example will get the messages for a campaign with an Id = 17 for the Direct Voting application:
    https://www.protexting.com/features/api/directVoting/results?campaign_id=17
    
  • Requesting the above information using the developer API key:
    https://www.protexting.com/features/api/directVoting/results?campaign_id=17&access_token=c7ac888fc9ceb42aa69ff915eef754f9cbbb1111
    
  • The following php code is an example for a code using the above URL:
    <?php
    //The api url to request from the Direct Voting app
    $url = "https://www.protexting.com/features/api/directVoting/results?campaign_id=17&access_token=c7ac888fc9ceb42aa69ff915eef754f9cbbb1111";
    //Your email
    $email = "test@protexting.com";
    //Your password
    $password = "jhsda872jsdat";

    // We send XML via CURL using POST with a http header of text/xml.
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_HTTPGET, 1);
    curl_setopt($ch, CURLOPT_USERPWD, $email . ":" . $password);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $result = curl_exec($ch);
    curl_close($ch);

    // Print CURL result.
    echo $result;
    ?>

Response formats

Different response formats are available - JSON and XML. The default response format is JSON. To have XML response add format=xml to the arguments.

Response fields

The following XML is an example for a Direct Voting response:

<?xml version="1.0" encoding="utf-8"?>
<root version="1.0">
  <campaign_id>17</campaign_id>
  <campaign_title>Favorite pen color</campaign_title>
  <pole_question>Whats your favoring pen color?</pole_question>
  <overall_total_number_of_votes>4</overall_total_number_of_votes>
  <short_code>82257</short_code>
  <choice>
	<choice_name>bluepen</choice_name>
	<number_of_votes>2</number_of_votes>
	<description>Blue pen with blue ink</description>
	<percentage_from_total>50</percentage_from_total>
	<percentage_from_total_as_string>50%</percentage_from_total_as_string>
  </choice>
  <choice>
	<choice_name>redpen</choice_name>
	<number_of_votes>1</number_of_votes>
	<description>Red pen with red ink</description>
	<percentage_from_total>25</percentage_from_total>
	<percentage_from_total_as_string>25%</percentage_from_total_as_string>
  </choice>
  <choice>
	<choice_name>greenpen</choice_name>
	<number_of_votes>1</number_of_votes>
	<description>Green pen with green ink</description>
	<percentage_from_total>25</percentage_from_total>
	<percentage_from_total_as_string>25%</percentage_from_total_as_string>
  </choice>
</root>

Parameters (args)

Field Type Description
campaign_id int The ID of your campaign. Available at App listing.
format string xml or json