Javapress - An API to connect wordpress through java. No need of XMLRPC or other libraries.

What's up everyone! I have created a small light weight API that you can use in your Java code to connect to your wordpress website/blog. It is in initial phases and does the basic functions. Hope it helps!


To download click here: https://drive.google.com/file/d/0BziaxOG6e3ODTEw2NjFSVzZveXc/view?usp=sharing

GitHub Repo: https://github.com/siddhantminocha/javapress

How to use:

It's a very easy to use API. 1) Download the zip.
2) There are two folder: lib and php. Upload all the php files to your wordpress directory and place all the jars in the "lib" folder in your classpath.

3) There are 8 php files. Open each file one by one. 
find the line 

if( $password == "newpassword"){

and change "newpassword" with a password of your choice in all the files. Don't forget the quotes. For eg. if you want to change the password to SiddhantMinocha, you will change the line like: 

if( $password == "SiddhantMinocha"){

Do this in all the 8 files. Use the same password in all files.


4)After you are done with php files, its time to move on to the java codes. 

5) First, add the jars to your classpath.

6) Read the self explanatory code. 


import javapress.*;
       
public class NewMain {

  
    public static void main(String[] args) {
  
 javapress myblog = new javapress();
 myblog.wordpress = "http://localhost/wordpress"; //your website location
 myblog.password = "newpassword"; //the password you have set in all php files.
       
 myblog.CreateNewPost("A new post", "This is the content of the newest post", 11); //Pass variables in the method
       
       
    }
   
}





Supported methods are:


CreateNewPost();

createCategory("categoryName");

createNewUser("username", "email", "password" );

deleteCategory(categoryID);

deletePost(postID);

getCategory("categoryName"); //Returns Cat ID

updatePost("postID", "postContent");

getPostType(postID); //returns type of the post in a string.



Lots of love! Happy Coding! :D

SHARE ON:

Hi! I'm Siddhant Minocha, a Jaipur based hacker/developer. I spend most of my day coding things, trying to develop the next billion dollar idea. When I'm not over-analyzing random stuff and people, I hang out with friends (mostly entrepreneurs). I'm in my final year of graduation and till now I have started and exited 3 startups and developed a lot of websites and software for different companies. Follow me on twitter and other social networks to see what I keep doing. You can also hire me to design/develop your website, if you're worried about your website or app's security or any other tech related work. See ya! :D

    Blogger Comment

0 comments:

Post a Comment