Skip to content
Paul Bakker edited this page May 30, 2013 · 3 revisions

This project can be used to import content into a wikidot site. It is a private project for use only by Paul Bakker.

REQUIREMENTS

This is a Java application. It is built using maven 3. You will need:

SETTING UP THE APPLICATION

The application needs a wikidot api key to run. See http://www.wikidot.com/doc:api In your maven settings.xml, you need a profile called wikidot-rpc-client, like:

<profiles>
  ...
  <profile>
    <id>wikidot-rpc-client</id>
    <properties>
      <wikidot.api.key>your-key-here</wikidot.api.key>
    </properties>
  </profile>
  ...
</profiles>

<activeProfiles>
  ...
  <activeProfile>wikidot-rpc-client</activeProfile>
</activeProfiles>

The property wikidot.api.key is filtered into the application.properties file by maven.

RUNNING THE APPLICATION

In a directory that contains the artifact described in BUILDING THE PROJECT below, execute the command:

java -Dfile.encoding=UTF-8 -jar wikidot-rpc-client-jar-with-dependencies.jar

where wikidot-site-name is the name of the wikidot, eg. mywiki for http://mywiki.wikidot.com, and path-to-source-directory is the full path to a directory containing the source files that have to be imported to a wikidot site. You must make sure that this directory exists and contains the text files (ending in .txt) for each of the pages you want to import. If you omit the file.encoding parameter, special characters end up not encoded properly on the wikidot. Read more about this here: http://stackoverflow.com/questions/10890578/how-to-set-the-jvm-charset-on-the-command-line

ALTERNATIVE: RUNNING THE PROJECT FROM AN IDE

This is probably the safest way, because it allows a debugging session that can iterate over statements step by step. Since I'm using IntelliJ IDEA, that's what I'm describing here, but you should be able to make it work in other IDE's as well. The properties file src/main/resources/importer_en_US.properties contains all properties that can be configured, i.e.

  • site.name: the name of the wikidot, eg. btales, into which to import the pages
  • source.dir: the full path to a directory containing the source files that have to be imported
  • files.dir: the full path to a directory containing the binary files that have to be imported In the class Importer, execute the main method, once the above properties have been set appropriately.

BUILDING THE PROJECT

$ mvn clean package assembly:single

This will generate two jars in the target directory:

wikidot-rpc-client.jar wikidot-rpc-client-jar-with-dependencies.jar

The with-dependencies one contains all the needed classes to run the project stand-alone.

REMOTE METHODS

Here's a list of remote methods, i.e. wikidot methods:

system.listMethods system.methodHelp system.methodSignature system.multicall categories.select tags.select pages.select pages.get_meta pages.get_one pages.save_one files.select files.get_meta files.get_one files.save_one users.get_me posts.select posts.get

They are documented in http://www.wikidot.com/doc:api-methods

Clone this wiki locally