Through looking at what information is available to Wikidot API developers, you can quickly gain an understanding of what you can and can not do with the API. Therefore I've taken the time to write this blog post to explain the input and output of most of the API's methods.
If you have any questions or suggestions, you can reply to this blog post or ask on the wikidot api developer forum.
system.listMethods
Parameters ()
If your language's XML-RPC libraries require a parameter, just create an Object[] array and set it to null. Then provide that as the parameter.
Return type
This method returns an array (list in Python) of Strings. Each String is the name of a method that the API supports. Both XML-RPC system methods (like "system.listMethods" itself) and Wikidot-specific methods are included in the list.
user.sites
Parameters (user)
Create a map (dictionary in Python) and add a new entry for each parameter.
- user - Wikidot username
Return type
This method returns an array (list in Python). Each element in the array is a map (dictionary in Python) containing the following entries:
- title - The site title
- name - The unix name for the site (i.e. name.wikidot.com)
- access - The access policy (open, closed or private)
Note that the user.sites method no longer exists in the latest version of the XML-RPC API.
site.categories
Parameters (site)
Create a map (dictionary in Python) and add a new entry for each parameter.
- site - The unix name of the site
Return type
This method returns an array (list in Python). Each element in the array is a map (dictionary in Python) containing the following entries:
- name - The name of the category
site.pages
Parameters (site) or (site, category)
Create a map (dictionary in Python) and add a new entry for each parameter.
- site - The unix name of the site
- category - The name of the category (optional)
Return type
This method returns an array (list in Python). Each element in the array is a map (dictionary in Python) containing the following entries:
- site - The unix name of the site
- parent_page - The fullname of this page's parent
- tag_string - A space-separated String of tags
- date_edited - The updated_at value for the page
- date_created - The created_at value for the page
- title_shown - See below for a description
- user_created - The created_by value for the page
- category - The category that the page belongs to
- title - See below for a description
- name - The unix name of the page
- user_edited - The updated_by value for the page
- title_or_unix_name - See below for a description
- tag_array - An array of tags (String objects I think)
- full_name - The full name of the page. If the category is _default, 'full_name' is the same as 'name'
There are three fields for the page title:
- title_shown - This is the title that appears when you view the page in a browser, including variables from auto-numbered categories.
- title - The title that a user enters when creating or editing the page. If the category is not autonumbered, this is the same as 'title_shown'.
- title_or_unix_name - If 'title' is an empty String, the page's unix name is shown instead. This is used for internal links in the web version of Wikidot.
page.get
Parameters (site, page)
Create a map (dictionary in Python) and add a new entry for each parameter.
- site - The unix name of the site
- page - The fullname of the page
Return type
This method returns an array (list in Python). Each element in the array is a map (dictionary in Python) containing the following entries:
- source - The Wikidot source code for the page
- html - The rendered HTML version of the page
- meta - The meta information for the page. This element is not a map (dictionary in Python), but is an array containing another map (dictionary in Python) with the same entries as the map (dictionary in Python) you can get from the 'site.pages' method.
page.files
Parameters (site, page)
Create a map (dictionary in Python) and add a new entry for each parameter.
- site - The unix name of the site
- page - The fullname of the page
Return type
This method returns an array (list in Python). Each element in the array is a map (dictionary in Python) containing the following entries:
- date_added - The date the file was uploaded
- description - An automatically-generated description of the file type
- name - The name of the file
- mime - The file's mime type
- comment - The comment added when the file was uploaded, if any
- url - The URL you can use to access the file in a web browser
- size - The size of the file in Bytes
TODO
I still need to work out the details for these methods, and will update this post as soon as I have done that:
- page.save
- user.valid
- system.methodHelp
- system.methodSignature
- system.multicall
Other resources
You may also find the official list of API methods useful: http://developer.wikidot.com/doc:api-methods
Shane, just interested… how are you calling the API in java at the moment. Will you release the library soon?
Kenneth Tsang (@jxeeno)
Not sure when I'll release the library… there are a few things that need to be sorted out with it first, even with the methods I've already implemented.
The code used to set up the connection is this (in the library it's hidden away so that you never need to type this… but if you want to connect before I release the Java library, try this)
If you link to the Apache XML-RPC libraries, you should find most of the classes you need in there. Just import them in your class.
Edit: I fixed a mistake in the code shown above, so make sure you use the updated version and not what you see in the email notification about my comment.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
By the way, I deliberately tried to avoid mentioning Java-specific information in the blog post, so that this can apply to all languages.
If you know any other languages well, e.g. Python, please have a look at it and make sure it still applies for that language (and let me know what I should change to fix it, if it doesn't).
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
The important stuff for Python is:
In the above, for "array" read "list", and for "map" read "dictionary". Otherwise it seems to be applicable.
Are you sure you mean 2D, Shane?Actually, yes that's what I meant. In trying to be as specific as possible I made a mistake.
I'll fix up the error about 2D arrays, and try to make the blog post more generalised. I know how to use the page.save method now, but will have to add it another day as I don't have my code in front of me.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Hmmm.. I'm still really stuck with JS.
Kenneth Tsang (@jxeeno)
Post preview:
Close preview