Spinbot

Article Spinning, Text Rewriting, Content Creation Tool.



Article Spinner API

How to use the Spinbot article spinning API:

  1. Create a Spinbot account.

  2. Purchase as many spin credits as your website or application will need.

  3. Integrate Spinbot Service requests (as described below) into your website or application.

  4. Sit back and let Spinbot work for you. All day, every day.

The elements of a Spinbot HTTP request:

(host)
https://api.spinbot.com
Service requests will be sent to and returned from this host address. It is recommended that you use the prefix 'https' rather than 'http' so your unique API key will be encrypted when it is sent over the wire.
Required.
(HTTP header)
x-auth-key: [YourApiKey]
Your Account/API key. This unique identifier is available via your account management page. It identifies you as a paid subscriber to the Spinbot service. Every time you send in a 'spin' request to the Spinbot service, one of the credits associated with this account will be consumed.
Required.
body The text you want to process. NOTE: The request body is ignored if you are getting available spins only.
(HTTP header)
x-multi-creds: true
Exclude this header or give a value of anything other than 'true' and the request will be treated as a standard, single spin credit request (only the first 10,000 characters will be accepted, the rest will be cut off).

Passing in the header as presented here indicates that the body, or the text to be rewritten, could be more than 10,000 characters, but the entirety of the body should be processed. In this case, each chunk of 10,000 characters will consume a spin credit until the entirety of the text is processed, up to a maximum of 500,000 characters. So, for example, a request with the header 'x-multi-creds: true' and a text body of 10,001 characters will consume two spin credits. Passing in more than 500,000 characters will result in a 400, Bad Request. If you have insufficient credit to process the entirety of the body text, then an 'Insufficient Spins' error will be returned, and the request will consume no spin credits. If the text is less than 10,000 characters, then only one credit will be consumed.
Optional.
(HTTP header)
x-spin-cap-words: [true|false]
If you omit this header, then the default 'false' is assumed. If set to 'true' (not case sensitive), then Spinbot will attempt to process capitalized words that do not occur at the beginning of the sentence. Spinbot attempts to process the first word of every sentence, even if it is capitalized regardless.
Optional.
(HTTP header)
x-words-to-skip: [value1,value2,...]
If any word in the input text contains either all or part of any of the values given, then this word will be ignored. If you omit this header, then Spinbot will attempt to process every word -- this is the default behavior. The value for this header should be a comma delineated list of values that represent either a whole or part of a word that you want Spinbot to always ignore (not spin). These strings are not case sensitive, so if you pass in "Doggi,food", then words such as 'doggie', 'doggies', 'foods' and 'FOODS' will be ignored.
Optional.
(HTTP header)
x-min-percent-change-per-sentence: [int between 1-100]
Acceptable values: Any integer between 1 and 100 or the string 'any'. Do not pass in a percentage sign with this header. If you pass in the string 'any', then all sentences will be returned regardless of how much they changed. 'any' is the default value for this header, and is the equivalent of omitting this option altogether. If you pass in 1, then Spinbot will only return sentences that were altered a minimum of 1% (probably every sentence). If you pass in 70, then Spinbot will only return sentences that changed about 70% (some sentences will probably not be returned if you pass in a significant amount of text. Please note that this figure is an estimation (more weight is given to words being totally replaced than reordered), so it is not recommended that you pass in a value greater than 70.
Optional.
(HTTP header)
x-action: getavailablespins
Specify this action if you want to find out how many spin credits you have remaining without detracting from your current spin count. NOTE: If you pass in any other options, including anything in the request body, the request will still be treated as a 'getavailablespins' request. Total remaining spins will be assigned to the header 'available-spins' (see response headers below).
Optional.

Useful response headers:

(HTTP header)
available-spins: [value]
This latest spin credit count will be returned for every successful request, whether you are doing a standard spin request, or getting your currently available spin credits (using 'x-action: getavailablespins').

If you attempt to make a 'spin' requests after this number has decreased to zero, then you will receive an 'Bad Request' response, including a 'spinbot-error' header message equal to 'Insufficient Spin Credits'. In this case you can still request your available spin credit count, which should equal zero.
(HTTP header)
spinbot-error: [text]
You will need catch a non-200/non-OK response code/status to be able to view this error response. The most relevant error you will see is "Insufficient Spin Credits". This means that you have run out of spin credits and must purchase more if you want to make additional API requests.

Code Examples


Use C# to make a standard Spinbot API 'spin' Request (this is a simple console app but it can be adapted into an ASP.NET MVC.NET web page):


using System;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        string textToSpin = "This is without a doubt the best article rewriting api in the world";
        string wordsToSkip = "rewrit,nonExistentWordPart";
        string percentToChange = "any";
        bool spinCapWords = false;
        string serviceUri = "https://api.spinbot.com";
        string authKey = "yourUniqueApiKey";
    
        WebRequest request = WebRequest.Create(serviceUri);
        request.Headers.Add("x-auth-key:" + authKey);
        request.Headers.Add("x-spin-cap-words:" + spinCapWords.ToString());
        request.Headers.Add("x-words-to-skip:" + wordsToSkip);
        request.Headers.Add("x-min-percent-change-per-sentence:" + percentToChange);
        request.Method = "POST";
        Stream dataStream = request.GetRequestStream();
        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(textToSpin);
        dataStream.Write(bytes, 0, bytes.Length);
        dataStream.Close();
    
        // Download data.
        WebResponse response = request.GetResponse();
    
        // get response from the server
        Stream stream = response.GetResponseStream();
        StreamReader reader = new StreamReader(stream);
        // this is your altered text 
        string spunText = reader.ReadToEnd();
        // keep track of remaining spins so your app can alert when needs be 
        string availableSpins = response.Headers["available-spins"]; 
        // now do something with your results
        Console.Out.WriteLine("\n\nSpun Text: " + spunText);
        Console.Out.WriteLine("\n\nAvailable Spins: " + availableSpins);
    }
}


Use C# to find out how many spin credits you have remaining (this will not subtract from your existing spin count):


using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;

class Program
{
    static void Main(string[] args)
    {
        string serviceUri = "https://api.spinbot.com/";
        string authKey = "yourUniqueApiKey";
            
        WebRequest request = WebRequest.Create(serviceUri);
        request.Headers.Add("x-auth-key:" + authKey);
        request.Headers.Add("x-action:getavailablespins");
        request.ContentLength = 0; // don't bother sending in a body
        request.Method = "POST";

        // Get the response.
        WebResponse response = request.GetResponse();
        // keep track of remaining spins so your app can alert when needs be 
        string availableSpins = response.Headers["available-spins"]; 
    }
}


Use PHP to make a Spinbot API Request and display the results on a web page:

<html>
    <body>
    <?
    $textToSpin = 'This is without a doubt the best article rewriting api in the world';
    echo '<br/>Original Text: <br/>'. $textToSpin;

    $url = 'https://api.spinbot.com';
    $header = array();
    // Required header:
    $spinbotApiKey = '<ENTER YOUR API KEY HERE>';
    $header[] = "x-auth-key:$spinbotApiKey";

    // optional header values
    $header[] = 'x-spin-cap-words:true';
    $header[] = 'x-words-to-skip:rewrit,nonExistentWordPart';
    $header[] = 'x-min-percent-change-per-sentence:any';

    // Execute cURL request, get response
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $textToSpin);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    $response = curl_exec($ch); 
    curl_close($ch);

    // Make the response readable
    list($strResponseHeaders, $strResponseBody) = explode("\r\n\r\n", $response, 2);
    $aHeaders = putHeadersTextIntoArray($strResponseHeaders);

    // Display return values
    echo '<br/><br/>Text After Spinning: <br/>' . $strResponseBody;
    // Notice the use of response header 'available-spins' to keep track of remaining Spinbot credits.
    echo '<br/><br/>Available Spins: <br/>' . $aHeaders['available-spins'];

    // helper function to process return header plain text
    function putHeadersTextIntoArray($header_text) {
        $headers = array();
        foreach (explode("\r\n", $header_text) as $i => $line)
            if ($i === 0) {
                $headers['http_code'] = $line;
            } else {
                list ($key, $value) = explode(': ', $line);
                $headers[$key] = $value;
            }
        return $headers;
    }
    ?>
    </body>
</html> 


Example sites that currently use the Spinbot API:
 
© 2017 - Spinbot.com | Blog | Tools