Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
popfilemodules:xmlrpc [2008/02/08 18:49] – external edit 127.0.0.1popfilemodules:xmlrpc [2010/09/09 19:46] (current) – external edit 127.0.0.1
Line 148: Line 148:
 # #
        
-my $sk = $xml->call("POPFile/API.get_session_key",'admin',//);+my $sk = $xml->call("POPFile/API.get_session_key",'admin','');
 my $key = $sk->result; my $key = $sk->result;
 my $method = "POPFile/API.$ARGV[0]"; my $method = "POPFile/API.$ARGV[0]";
Line 169: Line 169:
     print join ("\n","TRANSPORT ERROR: ", $xml->transport->status);       print join ("\n","TRANSPORT ERROR: ", $xml->transport->status);  
 } else  { } else  {
-    print join ("\n",$res->paramsall);+    if ( ref $res->paramsall eq 'ARRAY' ) { 
 +        print join "\n", @{$res->paramsall}; 
 +    } else { 
 +        print $res->paramsall; 
 +    }
 } }
 +print "\n";
  
 # #
Line 243: Line 248:
  
 # say hello and get a session key # say hello and get a session key
-my $sk = $xmlrpc-> call('POPFile/API.get_session_key','admin',//)+my $sk = $xmlrpc-> call('POPFile/API.get_session_key','admin','')
  -> result;  -> result;
  
Line 264: Line 269:
 ===== POPFile XML-RPC API ===== ===== POPFile XML-RPC API =====
  
-Full access to POPFile's API (declared in [[http://cvs.sourceforge.net/viewcvs.py/popfile/engine/POPFile/API.pm?view=markup| POPFile::API]] module) through UI::XMLRPC module. +Full access to POPFile's API (declared in [[http://getpopfile.org/browser/branches/b0_22_2/engine/POPFile/API.pm| POPFile::API]] module) through UI::XMLRPC module. 
-For further documentation on API syntax, see the [[http://cvs.sourceforge.net/viewcvs.py/popfile/engine/Classifier/Bayes.pm?view=markup| Classifier::Bayes]] module that ships with POPFile.+For further documentation on API syntax, see the [[http://getpopfile.org/browser/branches/b0_22_2/engine/Classifier/Bayes.pm| Classifier::Bayes]] module that ships with POPFile.
  
 Note that you must obtain a session_key using the get_session_key API call in order to use any of the API's. You should release the key using release_session_key when you are finished. Note that you must obtain a session_key using the get_session_key API call in order to use any of the API's. You should release the key using release_session_key when you are finished.
Line 272: Line 277:
  
 ||**Subroutine Name**||**Usage comments**|| ||**Subroutine Name**||**Usage comments**||
-||get_session_key||//call('POPFile/API.get_session_key','admin','')/returns a session_key|| +||get_session_key||<code>call('POPFile/API.get_session_key','admin','')</code> returns a session_key|| 
-||release_session_key||//call('POPFile/API.release_session_key','session_key')/releases the session key || +||release_session_key||<code>call('POPFile/API.release_session_key','session_key')</code> releases the session key || 
-||classify ||//call('POPFile/API.classify', 'session_key', 'filename')/returns bucketname, note that filename must exist in the popfile directory (or the full path must be specified) **on the machine that is running POPFile**.||+||classify ||<code>call('POPFile/API.classify', 'session_key', 'filename')</code> returns bucket name, note that filename must exist in the popfile directory (or the full path must be specified) **on the machine that is running POPFile**.||
 ||classify_and_modify||**Does not work for XmlRpc, expects filehandles, use handle_message instead.**|| ||classify_and_modify||**Does not work for XmlRpc, expects filehandles, use handle_message instead.**||
-||handle_message||//call('POPFile/API.handle_message', 'session_key', 'inputfilename', 'outputfilename')/ returns the history slot-id, bucketname, and a Boolean specifying whether a magnet was used for classification, similar to classify but adds message to POPFile history and writes message with POPFile headers to output file. **Note, there is a known issue with this call. It presently adds a . and 0x0d0a to the end of messages it processes.**|| +||handle_message||<code>call('POPFile/API.handle_message', 'session_key', 'inputfilename', 'outputfilename')</code>  returns bucketname, the history slot-id, and a Boolean specifying whether a magnet was used for classification, similar to classify but adds message to POPFile history and writes message with POPFile headers to output file. **Note, there is a known issue with this call. It presently adds a . and 0x0d0a to the end of output file.**|| 
-||get_buckets ||//call('POPFile/API.get_buckets','session_key')// returns an array of bucketnames || +||get_buckets ||<code>call('POPFile/API.get_buckets','session_key')</code> returns an array of bucket names (exclude 'unclassified' bucket)|| 
-||get_bucket_word_count  ||//call('POPFile/API.get_bucket_word_count', 'session_key', 'bucketname')// returns word count of bucket|| +||get_pseudo_buckets ||<code>call('POPFile/API.get_pseudo_buckets','session_key')</code> returns an array of pseudo-bucket names ('unclassified' bucket)|| 
-||get_bucket_word_list||//call('POPFile/API.get_bucket_word_list', 'session_key', 'bucketname')// returns array of words found in bucket|| +||get_all_buckets ||<code>call('POPFile/API.get_all_buckets','session_key')</code> returns an array of bucket names (include 'unclassified' bucket)|| 
-||get_word_count ||//call('POPFile/API.get_word_count','session_key')/returns word count of all buckets combined|| +||is_bucket ||<code>call('POPFile/API.is_bucket','session_key', 'bucketname')</code> returns 1 if the bucketname exists, returns 0 if the bucketname does not exist, or the bucketname is a pseudo-bucket ('unclassified' bucket)|| 
-||get_bucket_unique_count||//call('POPFile/API.get_bucket_unique_count', 'session_key', 'bucketname')/returns unique words in bucket|| +||is_pseudo_bucket ||<code>call('POPFile/API.is_pseudo_bucket','session_key', 'bucketname')</code> returns 1 if the bucketname exists and it is a pseudo-bucket ('unclassified' bucket), returns 0 if the bucketname does not exist, or the bucketname is not a pseudo-bucket|| 
-||get_bucket_color||//call('POPFile/API.get_bucket_color', 'session_key', 'bucketname')/returns color as string|| +||get_bucket_word_count  ||<code>call('POPFile/API.get_bucket_word_count', 'session_key', 'bucketname')</code> returns word count of bucket|| 
-||set_bucket_color||//call('POPFile/API.set_bucket_color', 'session_key', 'bucketname', 'colorstring')// returns color as string|| +||get_bucket_word_list||<code>call('POPFile/API.get_bucket_word_list', 'session_key', 'bucketname')</code> returns array of words found in bucket|| 
-||get_bucket_parameter||//call('POPFile/API.get_bucket_parameter', 'session_key', 'bucketname', 'parameter')/returns parameter value. Parameter can be one of //count//, //fpcount//, or //fncount//|| +||get_bucket_word_prefixes||<code>call('POPFile/API.get_bucket_word_prefixes', 'session_key', 'bucketname')</code> returns array of initial letters for words found in bucket|| 
-||set_bucket_parameter||//call('POPFile/API.set_bucket_parameter', 'session_key', 'bucketname', 'parameter', 'value')/sets the parameter to value, **no return**. Parameter can be one of //count//, //fpcount//, or //fncount// || +||get_count_for_word||<code>call('POPFile/API.get_cont_for_word', 'session_key', 'bucketname', 'someword')</code> returns word count for someword in bucket|| 
-||get_html_colored_message||**Note: get_html_colored_message was accidently left out of 0.22 but should be back in 0.22.1.** //call('POPFile/API.get_html_colored_message', 'session_key', 'filename')/returns string containing colored message, note that filename must exist in the popfile directory or the full path must be specified|| +||get_word_count ||<code>call('POPFile/API.get_word_count','session_key')</code> returns word count of all buckets combined|| 
-||create_bucket||//call('POPFile/API.create_bucket', 'session_key', 'bucketname')// **no return**|| +||get_bucket_unique_count||<code>call('POPFile/API.get_bucket_unique_count', 'session_key', 'bucketname')</code> returns unique words in bucket|| 
-||delete_bucket||//call('POPFile/API.delete_bucket', 'session_key', 'bucketname')// **returns 1 always**|| +||get_bucket_color||<code>call('POPFile/API.get_bucket_color', 'session_key', 'bucketname')</code> returns color as string. **Note: this API is DEPRECATED in favor of calling get_bucket_parameter for the parameter named 'color'**|| 
-||rename_bucket||//call('POPFile/API.rename_bucket', 'session_key', 'bucketname', 'newname')/returns 0 on failure, 1 on success|| +||set_bucket_color||<code>call('POPFile/API.set_bucket_color', 'session_key', 'bucketname', 'colorstring')</code> set the color of bucket. Returns 1 if succeeded. **Note: this API is DEPRECATED in favor of calling set_bucket_parameter for the parameter named 'color'**|| 
-||add_message_to_bucket||//call('POPFile/API.add_message_to_bucket', 'session_key', 'bucketname', 'filename')// returns 0 on failure, 1 on success, note that filename must exist in the popfile directory or the full path must be specified|| +||get_bucket_parameter||<code>call('POPFile/API.get_bucket_parameter', 'session_key', 'bucketname', 'parameter')</code> returns parameter value. Parameter can be one of //count// (classification count), //fpcount// (false positives), //fncount// (false negatives), //subject// (subject header modification), //xtc// (X-Text-Classification header), //xpl// (X-POPFile-Link header), //quarantine// (quarantine messages), or //color// (bucket color)|| 
-||remove_message_from_bucket ||//call('POPFile/API.remove_message_from_bucket', 'session_key', 'bucketname', 'filename')// returns 0 on failure, 1 on success, note that filename must exist in the popfile directory or the full path must be specified|| +||set_bucket_parameter||<code>call('POPFile/API.set_bucket_parameter', 'session_key', 'bucketname', 'parameter', 'value')</code> sets the parameter to value, **returns 1 if succeeded**. Parameter can be one of //count// (classification count), //fpcount// (false positives), //fncount// (false negatives), //subject// (subject header modification), //xtc// (X-Text-Classification header), //xpl// (X-POPFile-Link header), //quarantine// (quarantine messages), or //color// (bucket color)|| 
-||get_buckets_with_magnets ||//call('POPFile/API.get_buckets_with_magnets', 'session_key',)/returns array of bucket names with magnets || +||get_html_colored_message||**Note: get_html_colored_message was accidently left out of 0.22 but has been back in 0.22.1.** <code>call('POPFile/API.get_html_colored_message', 'session_key', 'filename')</code> returns string containing colored message, note that filename must exist in the popfile directory or the full path must be specified|| 
-||get_magnet_types_in_bucket ||//call('POPFile/API.get_magnet_types_in_bucket', 'session_key', 'bucketname')/returns array of magnet types for the bucket || +||create_bucket||<code>call('POPFile/API.create_bucket', 'session_key', 'bucketname')</code> returns 1 if succeeded|| 
-||clear_bucket||//call('POPFile/API.clear_bucket', 'session_key', 'bucketname')/empties the bucket, **no return**|| +||delete_bucket||<code>call('POPFile/API.delete_bucket', 'session_key', 'bucketname')</code> returns 1 if succeeded. Note that you cannot delete 'unclassified' bucket|| 
-||clear_magnets||//call('POPFile/API.clear_magnets','session_key',)// **no return**|| +||rename_bucket||<code>call('POPFile/API.rename_bucket', 'session_key', 'bucketname', 'newname')</code> returns 0 on failure, 1 on success|| 
-||get_magnets||//call('POPFile/API.get_magnets', 'session_key', 'bucketname','type')/returns array of magnets of the specified type for the bucket || +||add_message_to_bucket||<code>call('POPFile/API.add_message_to_bucket', 'session_key', 'bucketname', 'filename')</code> Train POPFile with a mail file (reclassify a mail file to bucketname). Returns 0 on failure, 1 on success, note that filename must exist in the popfile directory or the full path must be specified|| 
-||create_magnet||//call('POPFile/API.create_magnet', 'session_key', 'bucketname', 'magnettype','magnetvalue')// **no return**|| +||add_messages_to_bucket||<code>call('POPFile/API.add_messages_to_bucket', 'session_key', 'bucketname', 'filelist')</code> Train POPFile with mail files (reclassify mail files to bucketname). Returns 0 on failure, 1 on success, note that filenames must exist in the popfile directory or the full path must be specified|| 
-||get_magnet_types||//call('POPFile/API.get_magnet_types','session_key')/returns an array of valid POPFile magnet types|| +||remove_message_from_bucket ||<code>call('POPFile/API.remove_message_from_bucket', 'session_key', 'bucketname', 'filename')</code> Undo training POPFile. Returns 0 on failure, 1 on success, note that filename must exist in the popfile directory or the full path must be specified|| 
-||delete_magnet||//call('POPFile/API.delete_magnet', 'session_key', 'bucketname', 'magnettype','magnetvalue')// **no return**|| +||magnet_count ||<code>call('POPFile/API.magnet_count', 'session_key')</code> returns magnet count of all bucket combined || 
-||get_stopword_list||//call('POPFile/API.get_stopword_list','session_key')/returns array of stop words || +||get_buckets_with_magnets ||<code>call('POPFile/API.get_buckets_with_magnets', 'session_key')</code> returns array of bucket names specified by any magnets || 
-||add_stopword||//call('POPFile/API.add_stopword', 'session_key', 'mystopword')// returns 0 if failed, 1 if succeeded|| +||get_magnet_types_in_bucket ||<code>call('POPFile/API.get_magnet_types_in_bucket', 'session_key', 'bucketname')</code> returns array of magnet types for the bucket || 
-||remove_stopword||//call('POPFile/API.remove_stopword', 'session_key', 'mystopword')// returns 0 if failed, 1 if succeeded||+||clear_bucket||<code>call('POPFile/API.clear_bucket', 'session_key', 'bucketname')</code> empties the bucket. Returns 1 if succeeded|| 
 +||clear_magnets||<code>call('POPFile/API.clear_magnets','session_key')</code> removes all magnets. Returns 1 if succeeded|| 
 +||get_magnets||<code>call('POPFile/API.get_magnets', 'session_key', 'bucketname', 'type')</code> returns array of magnets of the specified type for the bucket || 
 +||create_magnet||<code>call('POPFile/API.create_magnet', 'session_key', 'bucketname', 'magnettype', 'magnetvalue')</code> creates a new magnet. Returns 1 if succeeded|| 
 +||get_magnet_types||<code>call('POPFile/API.get_magnet_types','session_key')</code> returns a hash list of valid POPFile magnet types and mail headers|| 
 +||delete_magnet||<code>call('POPFile/API.delete_magnet', 'session_key', 'bucketname', 'magnettype','magnetvalue')</code> deletes the magnet. Returns 1 if succeeded|| 
 +||get_stopword_list||<code>call('POPFile/API.get_stopword_list','session_key')</code> returns array of stop words || 
 +||add_stopword||<code>call('POPFile/API.add_stopword', 'session_key', 'mystopword')</code> adds a word to stop words. Returns 0 if failed, 1 if succeeded|| 
 +||remove_stopword||<code>call('POPFile/API.remove_stopword', 'session_key', 'mystopword')</code> removes a word from stop words. Returns 0 if failed, 1 if succeeded||
  
 Note: In the API calls above, the 'session_key' is the key that is returned to you by the API call get_session_key. Note: In the API calls above, the 'session_key' is the key that is returned to you by the API call get_session_key.
 
popfilemodules/xmlrpc.1202496561.txt.gz · Last modified: 2009/09/06 18:10 (external edit)
Old revisions

Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.

Recent changes RSS feed Donate Driven by DokuWiki
The content of this wiki is protected by the GNU Fee Documentation License