Trying to find the right way to use XML-RPC
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Trying to find the right way to use XML-RPC
Below is a ruby script I'm using to call the Joomla XML-RPC Blogger API.
All functions work except the call to blogger.newPost
It returns an error from Joomla: XMLRPC::FaultException: Post check failed
(Error generated from the logic in plgins/xmrpc/blogger.php line 215)
Any ideas on the problem or working examples of open code which successfully uses the xml-rpc blogger api?
require 'xmlrpc/client'
# Sets server to my site
server = XMLRPC::Client.new2('http://mysite.com/xmlrpc/index.php')
# function getUserInfo($appkey, $username, $password)
result = server.call('blogger.getUserInfo','unused_appkey','admin','password')
puts result
# function getRecentPosts($appkey, $blogid, $username, $password, $numposts)
result = server.call('blogger.getRecentPosts','unused_appkey','unused_blogid','admin','password',9)
puts result
# function newPost($appkey, $blogid, $username, $password, $content, $publish)
server.call('blogger.newPost','unused_appkey','unused_blogid','admin','password','Post This', true)
All functions work except the call to blogger.newPost
It returns an error from Joomla: XMLRPC::FaultException: Post check failed
(Error generated from the logic in plgins/xmrpc/blogger.php line 215)
Any ideas on the problem or working examples of open code which successfully uses the xml-rpc blogger api?
require 'xmlrpc/client'
# Sets server to my site
server = XMLRPC::Client.new2('http://mysite.com/xmlrpc/index.php')
# function getUserInfo($appkey, $username, $password)
result = server.call('blogger.getUserInfo','unused_appkey','admin','password')
puts result
# function getRecentPosts($appkey, $blogid, $username, $password, $numposts)
result = server.call('blogger.getRecentPosts','unused_appkey','unused_blogid','admin','password',9)
puts result
# function newPost($appkey, $blogid, $username, $password, $content, $publish)
server.call('blogger.newPost','unused_appkey','unused_blogid','admin','password','Post This', true)
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: Trying to find the right way to use XML-RPC
I do not know of anyone successfully using it. There have been many saying they want to use it.
To the best of my knowledge, it's not had much developer attention for a long time, nor do I believe it will have any before v 1.5 goes live.
In my opinion, this solution will need to come from our community.
Thanks!
Amy
To the best of my knowledge, it's not had much developer attention for a long time, nor do I believe it will have any before v 1.5 goes live.
In my opinion, this solution will need to come from our community.
Thanks!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
I've seen some confusing messages from the recent threads on it. It seemed they said the Blogger API as existed worked in Joomla. Maybe I'll brave that other thread to clarify.
I'll be working on something next month and am trying to ramp up and check existing functionality to have a good base to start.
I'll be working on something next month and am trying to ramp up and check existing functionality to have a good base to start.
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: Trying to find the right way to use XML-RPC
Almost two years ago, Johan added Blogger API v 1 to Joomla! v 1.5. That's the pieces you are working with. It really should be updated to 2.0.
There is some code started on a MetaWeblog API that there was just no time to finish. That might provide someone a place to start with that API.
Make certain to check the Extensions Directory, as well. There's a lot of interest, of course, in this area.
HTH,
Amy
There is some code started on a MetaWeblog API that there was just no time to finish. That might provide someone a place to start with that API.
Make certain to check the Extensions Directory, as well. There's a lot of interest, of course, in this area.
HTH,
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
Amy,
Thanks for your help. I'll look at the MetaWebBlog stuff.
After an afternoon cup of coffee, I discovered the Blogger API needed a tag in the last parameter.
The following works
Thanks for your help. I'll look at the MetaWebBlog stuff.
After an afternoon cup of coffee, I discovered the Blogger API needed a
The following works
Code: Select all
# function newPost($appkey, $blogid, $username, $password, $content, $publish)
result = server.call('blogger.newPost','unused_appkey','unused_blogid','admin','password','<title>Test Title</test>This shows up in the body<strong>So does this in bold</strong>', false)
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: Trying to find the right way to use XML-RPC
Does that completely resolve the problem, and now the Blogger API for xml-rpc is usable?
If so, let's get that patch moving into core.
If so, let's get that patch moving into core.
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
I only changed how I was using existing code. In other words, I was using Joomla wrong - but it is also undocumented.
No change to Joomla.
I'm going to tinker with it more and try to summarize what I've found. The initial problem I'm trying to solve is "documenting existing functionality." I'm interesting in expanding the functionality, but I need to figure where we are first.
I have a specific need I'll have to work towards first, which is massive importing from xml exported from another common program (deadlining in February) - but I honestly believe the functionality will require fleshing out something already existing and taking advantage of it, so hopefully I'll at least be able to document it for people to take advantage of. I get the impression people are really looking for a full implementation of a common API used by the many clients out there.
But, right now, as Joomla is, you can programatically:
-getRecentPosts
-newPost - post uncategorized messages
-getUserInfo
untested but things appear to be in order:
deletePost
editPost
getPost
I believe is irrelevant:
getUserBlogs
No change to Joomla.
I'm going to tinker with it more and try to summarize what I've found. The initial problem I'm trying to solve is "documenting existing functionality." I'm interesting in expanding the functionality, but I need to figure where we are first.
I have a specific need I'll have to work towards first, which is massive importing from xml exported from another common program (deadlining in February) - but I honestly believe the functionality will require fleshing out something already existing and taking advantage of it, so hopefully I'll at least be able to document it for people to take advantage of. I get the impression people are really looking for a full implementation of a common API used by the many clients out there.
But, right now, as Joomla is, you can programatically:
-getRecentPosts
-newPost - post uncategorized messages
-getUserInfo
untested but things appear to be in order:
deletePost
editPost
getPost
I believe is irrelevant:
getUserBlogs
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: Trying to find the right way to use XML-RPC
That is great! Anything you can shout out on that topic, from time to time will be appreciated. I hope others interested might also join in and you could learn from one another.
Good stuff. Appreciate it very much.
Amy
Good stuff. Appreciate it very much.
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
Below is a list of the functions and working ruby examples. Some comments included. Some more work to be done
Code: Select all
require 'xmlrpc/client'
# Sets server to my site
server = XMLRPC::Client.new2('http://joomla.drapetomanics.com/xmlrpc/index.php')
## function getUserBlogs($appkey, $username, $password)
## Errors out - irrelevant
# result = server.call('blogger.getUserBlogs','unused_appkey','admin','password')
# puts result
## function getUserInfo($appkey, $username, $password)
result = server.call('blogger.getUserInfo','unused_appkey','admin','password')
puts result
## function getPost($appkey, $postid, $username, $password)
result = server.call('blogger.getPost','unused_appkey','1','admin','password')
puts result
## function editPost($appkey, $postid, $username, $password, $content, $publish)
result = server.call('blogger.editPost','unused_appkey','2','admin','password','<titel>new content</title>content',true)
puts result
## XMLRPC::FaultException: Post check failed 2
## function deletePost($appkey, $postid, $username, $password, $publish)
result = server.call('blogger.deletePost','unused_appkey','1','admin','password',false)
puts result
#Missing return value initially
#no post afterwards
## function getRecentPosts($appkey, $blogid, $username, $password, $numposts)
result = server.call('blogger.getRecentPosts','unused_appkey','unused_blogid','admin','password',9)
puts result
## function getTemplate($appkey, $blogid, $username, $password, $templateType)
## not implemented
## function newPost($appkey, $blogid, $username, $password, $content, $publish)
result = server.call('blogger.newPost','unused_appkey','unused_blogid','admin','password','<title>Test Title4</title>test body<strong>bold</strong>', false)
puts result
Re: Trying to find the right way to use XML-RPC
Great, cacimar !!
I would love to add some optional things in postNews function
result = server.call('blogger.newPost','unused_appkey','unused_blogid','admin','password','Test Title4 The CMS test bodyboldmore and more ', false)
puts result
You can see all this stuff in joomladir/plugins/xmlrpc/blogger.php
I would love to add some optional things in postNews function
result = server.call('blogger.newPost','unused_appkey','unused_blogid','admin','password','
puts result
You can see all this stuff in joomladir/plugins/xmlrpc/blogger.php
just ordinary woman
http://nuraini.net
http://nuraini.net
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
Aini,
When I tested the newPost before - and< more text>didn't seem to work.. The information seemed to go nowhere.. I haven't traced down the functionality there yet.
When I tested the newPost before -
Re: Trying to find the right way to use XML-RPC
could you attach your ruby code project ?
I will check it ...
I will check it ...
just ordinary woman
http://nuraini.net
http://nuraini.net
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: Trying to find the right way to use XML-RPC
Rich -
You really lucked out. You have a core developer paying attention to your project. I guess you show a little promise!
Thanks, Aini!
Amy
You really lucked out. You have a core developer paying attention to your project. I guess you show a little promise!
Thanks, Aini!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
aini,
I've attached my basic ruby testing script.
The very last call is the attempt to post. seems to go nowhere and doesn't appear to affect the category or section the new article is assigned to.
I mentioned earlier in the thread, I'm working on this now only in the background, but in early February I'll be working on it more with the hopes of transforming archived xml data (from Adobe inDesign) to a format useable by Joomla and posting it.
I've attached my basic ruby testing script.
The very last call is the attempt to post.
I mentioned earlier in the thread, I'm working on this now only in the background, but in early February I'll be working on it more with the hopes of transforming archived xml data (from Adobe inDesign) to a format useable by Joomla and posting it.
- Attachments
-
- joomla_rpc.rb.txt
- (2.23 KiB) Downloaded 11 times
Re: Trying to find the right way to use XML-RPC
Hi Rich,
Well, I fully understand
It was Joomla bugs
I will fix the bug tomorrow
It sounds you have been working interesting stuff
Thanks in advance
Well, I fully understand
It was Joomla bugs
I will fix the bug tomorrow
It sounds you have been working interesting stuff
Thanks in advance
just ordinary woman
http://nuraini.net
http://nuraini.net
- cacimar
- Joomla! Apprentice
- Posts: 13
- Joined: Sun Aug 28, 2005 10:29 pm
- Location: Austin, TX
- Contact:
Re: Trying to find the right way to use XML-RPC
Thanks Aini,
Maybe after I see your changes, I'll be able to see enough to contribute more to that area as well.
Maybe after I see your changes, I'll be able to see enough to contribute more to that area as well.
Re: Trying to find the right way to use XML-RPC
I have put the patch in Joomla Tracker http://joomlacode.org/gf/project/joomla ... em_id=9399
Waiting Q&T to check it
Here is my following patch, You can test it in your PC
Anyway, for category tag, it is configured by default at blogger plugin configuration
You can see this following code :
I will ask in J!Dev List whether we could define any category through XML-RPC
That would be more nice
Waiting Q&T to check it
Here is my following patch, You can test it in your PC
Code: Select all
Index: /data1/trunk/plugins/xmlrpc/blogger.php
===================================================================
--- /data1/trunk/plugins/xmlrpc/blogger.php (revision 9962)
+++ /data1/trunk/plugins/xmlrpc/blogger.php (working copy)
@@ -428,8 +428,9 @@
$match = array();
if ( preg_match('/<more_text>(.+?)<\/more_text>/is', $content, $match) )
{
- $fulltext = trim($match[1], ',');
- $fulltext = explode(',', $fulltext);
+ $fulltext = $match[0];
+ $fulltext = preg_replace('/<more_text>/si', '', $fulltext);
+ $fulltext = preg_replace('/<\/more_text>/si', '', $fulltext);
}
return $fulltext;
Anyway, for category tag, it is configured by default at blogger plugin configuration
You can see this following code :
Code: Select all
// load the category
$cat =& JTable::getInstance('category');
$cat->load($params->get( 'catid', 1 ));
I will ask in J!Dev List whether we could define any category through XML-RPC
That would be more nice
just ordinary woman
http://nuraini.net
http://nuraini.net