X-Spinner API

The X-Spinner API is designed to be extremely simple and easy to understand. All you have to do is make an HTTP request with POST variables. If the spinning is successful, the HTTP request will return the spun text directly. If the spinning is failed, the HTTP request will return empty string. Our example below is a C# example, but you can use whatever programming language you want.

HTTP POST URL

The HTTP POST URL is up to which IP and Port does X-Spinner listen at. The default listen ip and port of X-Spinner is 127.0.0.1 and 80 port, so the default post url is http://127.0.0.1:80/ . But X-Spinner user may change the listen ip and port, so you'd better let your users input the X-Spinner listen ip and port in your software and get the right post url.

HTTP POST Parameters

xstext   (Required) - The text that you would like X-Spinner to spin.

spintype (Optional) - 0 means spin to new article, 1 means spin to {|} format.

removeold (Optional) - 0 means don't remove original word in spin result, 1 means remove original word in spin result.

protectw  (Optional) - If you don't want to protect any word, set it to protectw=null. If you want to protect some words, set it like protectw=word1,word2,word3, then X-Spinner will not spin these words.

spinway   (Optional) - 0 uses free spin, 1 users normal spin, 2 users super spin.

thesaurus (Optional) - Default will use the default thesaurus in X-Spinner, the values of this parameter can be Arabic, Belarusian, Bulgarian, Croatian, Danish, Dutch, English, Filipino, Finnish, French, German,
Greek, Hebrew, Indonesian, Italian, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Slovak,
Slovenian, Spanish, Swedish, Turkish, Vietnamese and yourself thesaurus name in X-Spinner. 
(This parameter only be valid in X-Spinner  Developer Version)

Notice:

1.  All parameters name need be lowercase.

2. X-Spinner will use the settings in X-Spinner software if you don’t send the parameter in your post. 

HTTP POST Encode

Because X-Spinner supports many language including Spanish, French and Dutch etc. Some language need use UTF8 encode in the POST Request and Response for getting right text, so X-Spinner API only use UTF8 to accept your request data and response using UTF8 encode. This is very important, if you don't use UTF8, will get error text.

Example Code

public string xspinner(string ip, string port, string txt)
{
   System.Net.WebClient wb = new System.Net.WebClient();
   
string postdata = "xstext=" + txt;
   
byte[] postdata1 = Encoding.UTF8.GetBytes(postdata);
   
byte[] ret = wb.UploadData("http://" + ip + ":" + port, "POST", postdata1);
   
return Encoding.UTF8.GetString(ret);
}
//Load the function to use x-spinner api
xspinner("127.0.0.1","80","The X-Spinner API is designed to be extremely simple and easy to understand.");


                

Example Output:

The X-Spinner API {is designed to|was created to} be extremely {simple and easy|easy and simple} to {understand|use}.


                

Example Failure Output:

If the spin is failed, X-Spinner will just return empty string.

©2014 - www.x-spinner.com Related