Page 1 of 2

170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Jan 21, 2008 11:21 pm
by justo.derivera
Hi, I claimed this cool task :D

From the google page:
[quote="GHOP page"]
Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

MetaWeblog

1. Basic entry-points

metaWeblog.newPost
metaWeblog.editPost
metaWeblog.getPost

2. with MT extensions

metaWeblog.getCategories
metaWeblog.getRecentPosts
metaWeblog.newMediaObject

3. MetaWeblog API aliases for Blogger API

metaWeblog.deletePost
metaWeblog.getTemplate
metaWeblog.setTemplate
metaWeblog.getUsersBlogs

Test ability for each to interact with Joomla! v 1.5 using the following tools:

1. Using Flock web browser ( http://www.flock.com/ )
2. Windows Live Writer (proprietary - free - http://writer.live.com)
3. ScribeFire (Firefox plugin -
https://addons.mozilla.org/en-US/firefox/addon/1730)

Resources:
- API http://www.xmlrpc.com/metaWeblogApi
- http://www.xmlrpc.com/stories/storyReader$2460
- WordPress implementation (strongly recommend downloading Source and
looking at xmlrpc.php; GPL'ed code could be adapted for Joomla!'s
structures provided WordPress copyright is properly note.)

  * To install Joomla! on an XAMPP localhost:

  # XAMPP - http://www.apachefriends.org
  # Download Joomla! - http://help.joomla.org/content/view/1942/302/
  # Install Joomla! on a localhost -
http://help.joomla.org/content/view/1947/306/

    * Coding resources:

  # The core code! :-)
  # Plugins - http://forum.joomla.org/index.php?topic=233628
  # Model View Controller -
http://dev.joomla.org/component/option, ... orld_mvc1/
  # Modules and Components - http://www.jlleblanc.com/blogcategory/0/
  # Internationalization -
http://forum.joomla.org/index.php/topic ... msg1102267

    * IRC #joomlaGHOP on freenode

Skills needed

    * Knowledge of PHP
    * Knowledge of Joomla! v 1.5 Extension Development
    * Creativity and problem solving skills.

Difficulty

Basic
Work Product

    * Installable Joomla! v 1.5 extension(s) with internationalization
support.

Licensing

All code must be created using the GNU General Public License version 2.
http://www.gnu.org/licenses/old-license ... .html#SEC4

Documentation written for this task must be made available under the
Joomla! Electronic Documentation License.
Extra Credit (Optional)

1. Register your project at Joomlacode
2. When you are ready to release, submit your extension to the Joomla!
Extensions Directory.

Time Limit

End of Google Program.

If a Joomla! GHOP recognizes you as the task claimant, read
http://forum.joomla.org/index.php/topic,239201.0.html and respond ASAP This
requires CLOSE interaction with the community. Please try to check in at
least once every other day until the contest close. Share code and
testing,e tc.
[/quote]

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Jan 21, 2008 11:26 pm
by AmyStephen
OK - I thought I was happy YESTERDAY! I am down right ecstatic today. This is a good one - sooo important and I am certain you can do this and guess what - we need it in a big way.

Not to get ahead of ourselves, here, but it can also be a pattern for other APIs.

OK. Way to go. Rock on! Plenty to sink your teeth into here. Thanks! Please stay in close contact and let us know how it's going - ask questions and we'll all learn together!

Carry on, my friend!
Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 23, 2008 12:17 am
by ianmac
Hey!

I'm here for support, so justo, if there is anything I can do to help support you in this task, let me know.

Feel free to post here if you have any questions and I will try and keep tabs on this thread as well.

Ian

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 23, 2008 3:34 am
by Jinx
Hi,

Interesting task this one, just like Ian I wanna offer you my help and support too. I have a bit of code laying around that I wrote a while ago and that could be used as a starting point. If you are interested in this let me know.

Cheers,

Johan

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 23, 2008 4:53 am
by justo.derivera
Hi, I already figured out how this works and coded the metaWeblog.newPost entry point, and it works fine :D (tested with windows live writer and the ScribeFire firefox add-on). I addapted the code from the blogger API plugin.
I'm working on the other entry points now, this is very exciting :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 23, 2008 3:03 pm
by AmyStephen
Justo -

Last night, I tried testing this from Flock, but was not able to logon.

I copied your files to the plugins\xmlrpc folder. Then, I inserted a new record into the plugins table, making certain it was enabled and also that the web services are enabled in the Global configuration.

I hard coded the category number to match a category that the user I was using had Publisher access to.

Is there anything else I should do to try to test your work?

+++

Also, want to make you aware that aini is apparently going to make changes in the xmlrpc area. I will PM her so that she might also keep an eye on this thread.

As you can see, there's a tiny bit of interest in this. ;)

Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 23, 2008 7:34 pm
by justo.derivera
Amy: I tested it with Flock and it worked. Did you set the Access Point to: http://YourJoomlaSite/xmlrpc/index.php in the account creation?

I have coded a few more entry points (getRecentPosts, getPost) and they worked in scribefire and live writer, cheers :D. I'll post the code soon when I add a few more things.

Justo

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 23, 2008 8:01 pm
by AmyStephen
justo.derivera wrote: Amy: I tested it with Flock and it worked. Did you set the Access Point to: http://YourJoomlaSite/xmlrpc/index.php in the account creation?
Justo -

I did not. That could easily be the problem. I pointed it to YourJoomlaSite/xmlrpc.

Will retest - thanks for your help!

Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Thu Jan 24, 2008 3:58 am
by aini
I am here  :-*

Did anybody call me ?  :pop

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Thu Jan 24, 2008 4:06 am
by AmyStephen
Aini -
I certainly did!  :-*

I know you are watching over another community member who is working with the Blogger API, and I saw that you made changes to that API to help him out.  I also wanted to make you aware of Justo's work with the MetaWeblog API - in case there are issues or recommendations you might have for him in his work given what you are seeing with the Blogger API.

Here is the Blog Calendar Sidebar Component and Module he created with his last task. As you will see, Justo is exceptionally bright and quite capable - worth our time.

Thank you so very much,
Amy :)

Justo - hope to retest tonight. Thanks!

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Thu Jan 24, 2008 6:55 am
by justo.derivera
Thanks everyone for the interest :)
I have coded a few more entrypoints:
metaWeblog.getCategories
metaWeblog.getRecentPosts (this is not working well with flock :-/)
metaWeblog.editPost
metaWeblog.getPost

Also, now you can select the category of the post in the blog editor (only in live writer and flock, scribefire doesn't have this option). And now you can put a read more bar by simply writing in the html code (or in flock: Insert-> Horizontal Line), the script splits the content into introtext and fulltext using that bar.

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Thu Jan 24, 2008 8:02 am
by aini
Hi Justo,

When I tick the "add bloged with flock", the content would be missed
And you should filter categories in your  "metaWeblog.getCategories"

Not all categories are content categories, some of them are banner, links categories

Only select category has  section parent :)
join #__categories with #__section

take a look your code in line 255


Anyway, great Job !!  ;)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Thu Jan 24, 2008 11:55 pm
by AmyStephen
Image

Flock is a cool browser. It certainly ought to work hand in glove with Joomla! v 1.5.

Image

I am very happy with this.  :-*

Keep up the good work!
Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 3:04 am
by aini
@Amy ...
I am glad as well  ;D

@Justo,

Please take a look line 83-84
You should handle if people do not want to make read more options
Those line would not let people to avoid to use read more options

Keep coding  ;)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 3:22 pm
by ianmac
Anybody know of a reason why this doesn't seem to be working in flock for me?

I did manage to get the phpxmlrpc library and use their debugger to add a new post to the site, but Flock doesn't seem to like it.

Hmmm....

Ian

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 4:14 pm
by AmyStephen
I used it in Flock.

What all did you do?

Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 4:35 pm
by ianmac
I started flock...

Under blogging, I selected 'Self-Hosted blog'
First screen, I entered...  http://127.0.0.1/j15release/xmlrpc/index.php
It returned saying Flock could not find an API for your blog...
I hit next to manually configure...
Under API, I selected MetaWebLog
For access point, I entered the same address as above
I entered my admin username and password...

and of course it works now...  I spent a couple of hours last night messing with it...

I don't get it...  at that point, before, it would say there was a problem, and I couldn't add the account...

So, now I can post to the site.  BUT...  when I post, I get the following error message:

Code: Select all

<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct><member><name>faultCode</name>
<value><int>105</int></value>
</member>
<member>
<name>faultString</name>
<value><string>XML error: Invalid document end at line 1, column 1</string></value>
</member>
</struct>
</value>

</fault>
</methodResponse>
Although the post still gets posted.  The only problem that seems to remain is that no section value is pushed into the article.  Is anybody else seeing this?  Of course, there is no section coming from flock, because the API doesn't support it, but you can look it up...

So here are my comments...  Instead of just listing the category names, I would list the section names and category names...
So...  in the category list you might have:
About Joomla!/The CMS
About Joomla!/The Project
About Joomla!/THe Community
FAQs/Current Users
...

But great work!  pretty spiffy!

thanks,
Ian

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 4:42 pm
by aini
@Ian

I got your error 2 days ago
Please don't tick 2 options after you push publish button
It works for me

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 4:47 pm
by AmyStephen
I do think there is something a bit unpredictable - unknown at least - I had trouble initially configuring, too. The second time I tried it, I got the same errors, but after continuing to try, it worked. I chalked it up to "Amy error, again." We'll have to do a lot of testing on a lot of different server types (even after the contest) to make certain it's sturdy.

The article I posted did not have section or category selected, even though I selected these in Flock. I assumed that there are still things under development. When Justo says he is done, then we can throughly test the data mapping.

T.G noticed this thread and made an announcement to others of this project. I asked that others please avoid posting in this thread as it is a contest and the judges and developers are working with the contestant. When something is available for broader testing, we will share.

I must be very strict on that. We cannot disrupt the contest. Thank you for understanding!
Amy :)

aini - I will see if I can reproduce the errors given your advice. If we know what causes the problem, we can document these steps. Good work!

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Fri Jan 25, 2008 7:38 pm
by justo.derivera
I didn't have time to code anything yesterday.
The code I posted was very incomplete, I'm now fixing most of the errors.
But this error

Code: Select all

<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct><member><name>faultCode</name>
<value><int>105</int></value>
</member>
<member>
<name>faultString</name>
<value><string>XML error: Invalid document end at line 1, column 1</string></value>
</member>
</struct>
</value>

</fault>
</methodResponse>
I think this is happening because the blog editor expects that the xmlrpc is in the same folder than the frontpage (for example: http://JoomlaSite/xmlrpc.php), and takes http://JoomlaSite/ as the frontpage.
In Joomla the xmlrpc file is in http://JoomlaSite/xmlrpc/index.php so the blog editor thinks that the frontpage is http://JoomlaSite/xmlrpc/ . When you tick "Visit your blog after publishing" it takes you to http://JoomlaSite/xmlrpc/ and that page gives an error (since you are not sending any xml data).
A quick fix for this could be adding to xmlrpc/index.php a redirect to the frontpage if no xml data is received.

I will be back with a more stable code :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Sat Jan 26, 2008 4:29 am
by justo.derivera
I have good news! I looked into the code of the wordpress xmlrpc.php file to see how it does to get everything configured automatically when creating an account on the editor, it's something called Real Simply Discovery (RSD). So I tried to get this working for Joomla! and... it works great :D.
Here are the steps:
1.Copy this in components/com_content/views/frontpage/view.html.php after line 77:

Code: Select all

			$attribs = array('type' => 'application/rsd+xml', 'title' => 'RSD');
			$document->addHeadLink(JURI::base().'xmlrpc/rsd.php', 'EditURI', 'rel', $attribs);
That is the code to add the that the will be read by the blog editor to get the configuration file (rsd.php)

2.Copy xmlrpc.php into the root folder of Joomla

3.Copy rsd.php into the xmlrpc folder

4.Create an account in your favourite blog editor, type the root url of your site (http://YourJoomlaSite/), type your username and password and that's it! you are ready for posting articles :D

I also added/fixed a few things to the plugin:
-The categories are displayed like Category (Section)
-The articles are saved in the parent section of the category
-Using as read more is optional (it's set in the plugin configuration)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Sat Jan 26, 2008 5:21 am
by aini
Great Job ... Justo  :D

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Jan 28, 2008 10:21 pm
by AmyStephen
justo.derivera wrote: I have good news! I looked into the code of the wordpress xmlrpc.php file to see how it does to get everything configured automatically when creating an account on the editor, it's something called Real Simply Discovery (RSD). So I tried to get this working for Joomla! and... it works great :D.
Here are the steps:
1.Copy this in components/com_content/views/frontpage/view.html.php after line 77:

Code: Select all

			$attribs = array('type' => 'application/rsd+xml', 'title' => 'RSD');
			$document->addHeadLink(JURI::base().'xmlrpc/rsd.php', 'EditURI', 'rel', $attribs);
That is the code to add the that the will be read by the blog editor to get the configuration file (rsd.php)

2.Copy xmlrpc.php into the root folder of Joomla

3.Copy rsd.php into the xmlrpc folder

4.Create an account in your favourite blog editor, type the root url of your site (http://YourJoomlaSite/), type your username and password and that's it! you are ready for posting articles :D
I like the concept of simply configuration. But, I am concerned to update core files (I realize that is a norm with WP.)

Is there anyway to add that code to the template's index.php file?

Thanks!
Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Tue Jan 29, 2008 4:55 am
by AmyStephen
Will do some more thorough testing on this tomorrow, Justo. Really good work!

Thanks!
Amy :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Wed Jan 30, 2008 8:03 am
by justo.derivera
AmyStephen wrote: Is there anyway to add that code to the template's index.php file?
Yes, I think that it's possible, I'll look into it this evening.

I finally got the getRecentPosts working on flock :). Also, I added an option to publish all the articles in the frontpage, or to use a special category ('Frontpage'): if you select this category in the editor, the post will be added to the frontpage.

I'm a bit confused about the read more text:
None of the editors (Flock, scribeFire, live writer) has any option to insert a read more separator (or I couldn't find it :-\).
I believe that the standard tag for the read more separator is , but couldn't find any documentation about it.

Other problem (minor problem): Flock uses the to display the category name instead of the tag when calling metaWeblog.getCategories. I already posted this in the Flock forum, and will be submitting the bug to bugzilla when I have time.

The new version (0.3alpha) is avaible at JoomlaCode

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Sun Feb 03, 2008 9:19 pm
by justo.derivera
Hello,

I released a new version (0.5). Added:

-Use of the users access levels. This means that, for example, a user who is just an Author can't edit other users articles, or publish the articles directly (the admin has to publish them)
-Added the newMediaObject function, this allows the user to upload media to the page. The only blog editor that uses this function is Live Writer.
-Added custom getUserInfo and getUserBlogs, instead of using the ones from the blogger API.

I need final review please (the contest ends in a few hours :laugh:). Don't worry, I'll continue to develop this plugin after the contest has finished :)

JoomlaCode page

Notes for installation:
The script url is http://YOUR_SITE.COM/xmlrpc/index.php
The plugin will work if the blogger API plugin is enabled, but it's recommended to disable it.

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Feb 04, 2008 12:55 am
by justo.derivera
New version! 0.6.
I tested this with scribeFire, Live and Flock, and everything seems to work fine :). Oh, and I was wrong when I said that the only editor that uses newMediaObject is Live Writer, scribeFire also uses it :)

Fixed:
-Now the blog editor gets the blog url right, this means that it will redirect you to your site's frontpage when you post an article, instead of redirecting you to the xmlrpc page like before.
-Some minor errors with editing

metaWeblog API plugin 0.6

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Feb 04, 2008 5:53 am
by mcsmom
Justo,

Great work,thanks for your contributions! If you can, try to upload the work to google.

Elin

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Feb 04, 2008 6:26 am
by justo.derivera
mcsmom wrote: Justo,

Great work,thanks for your contributions! If you can, try to upload the work to google.

Elin
Hi, I already posted a link to the JoomlaCode page in the google page, and Amy closed the issue.

So, this is finished :). It has been a great introduction to Open Source and Joomla, and now that it's over I'd love to keep contributing for Joomla :-*

Thanks to everyone! :)

Re: 170 - Implement MetaWeblog API to interact with Joomla! v 1.5 xml-rpc plugin

Posted: Mon Feb 04, 2008 6:27 am
by AmyStephen
Justo -

What can I say, dude? You ROCK! You had a couple of really challenging tasks and you dug in deep, took your time coming up with good solutions and worked hard. You are going to be someone people enjoy working with because you are dependable and you get things done correctly.

I did more testing tonight and really like what I saw. It will be good for you and Ian and I to work together in the coming weeks on really nailing this extension down tightly. If you Skype, please add me (AmyStephen) and we'll IM on this. It's going to be a frequently used extension and, as you know, very important to do correctly.

Thanks so much for coming to Joomla!. You are someone we very much appreciate - I hope you enjoyed your experience and I hope we continue to see you around!

Take care,
Amy :)