0

I am using JoeBlogs https://github.com/alexjamesbrown/JoeBlogs to handle stuff on some of my wordpress websites. I am having some problems with creating a new category and uploading a picture.

Here is my code for creating a new category:

var wpWrapper = new WordPressWrapper("http://192.168.1.2/xmlrpc.php", "admin", "admin");
wpWrapper.NewCategory("some description", 0, "cat1", "slug here");

I am getting the following error from CookComputing library:

XmlRpcServerException: Not Found

I get the same error for uploading a picture. I've tried 2 versions of uploading a picture with uploadfile and newmediaobject. Here is what I've made with the newmediaobject:

var blog = new WordPressWrapper("http://192.168.1.2/wordpress", "admin", "admin");

byte[] imageData = System.IO.File.ReadAllBytes("desert.jpg");

var img = blog.NewMediaObject(new MediaObject { Bits = imageData, Name = "desert.jpg", Type = "image/jpeg" });

I am getting this error: Response from server does not contain valid XML

Here is my second try with uploadfile:

var blog = new WordPressWrapper("http://192.168.1.2/wordpress", "admin", "admin");

wpWrapper.UploadFile("desert.jpg", "desert.jpg", true,"image/jpeg");

I am getting the same error, with the invalid XML (just like the first try with mediaobject).

What do you guys suggest ?

I am open to other libraries that could help me achieve this.

user1812076
  • 269
  • 5
  • 21

1 Answers1

2

Ok, so the problems look like they were REALLY SIMPLE.

The xmlrpc.php file for my wordpress is in this path

192.162.1.2/wordpress/xmlrpc.php

In the first part (create category), I forgot to add "wordpress" in the uri. For the second part (upload image), I haven't forgot to add "wordpress" but I forgot to add "xmlrpc.php" at the end.

Stupid mistakes, but for those who encouter the same problems, check that out first.

user1812076
  • 269
  • 5
  • 21