Home « Server software «
Documentation: services/blog.php
services/blog.php - Process remote blog calls
This script interfaces YACS with popular weblog client software.The support of the XML-RPC API in YACS is really straightforward. The main complexity is that different words are used for same things. Therefore, please keep in mind that metaWeblog' blogs are YACS sections.
At the moment YACS supports following specifications:
- blogger (except getTemplate, setTemplate)
- metaWeblog
Error codes
YACS uses standard error codes, as specified in Specification for Fault Code Interoperability: "As the number of xml-rpc server implementations has proliferated, so has the number of error codes and descriptions. The charter of this specification is to define a small set of error codes that are common across most server implementations so that clients can programmatically handle common errors such as "method not found" or "parse error"."Here are the error codes and their meaning:
- -32700 ---> parse error. not well formed
- -32701 ---> parse error. unsupported encoding
- -32702 ---> parse error. invalid character for encoding
- -32600 ---> server error. invalid xml-rpc. not conforming to spec.
- -32601 ---> server error. requested method not found
- -32602 ---> server error. invalid method parameters (bad login, etc.)
- -32603 ---> server error. internal xml-rpc error (no response)
- -32500 ---> application error (database error)
- -32400 ---> system error
- -32300 ---> transport error
blogger.deletePost
Definitely suppress an existing post.Syntax: blogger.deletePost(ignored_appkey, postid, username, password) returns boolean
blogger.editPost
Modify or publish an existing post.Syntax: blogger.editPost(ignored_appkey, postid, username, password, content, publish) returns boolean
The content field can include following HTML tags:
- source - set the page source, usually, an originating URL
- introduction - set the page introduction
If the publish field is set to TRUE, the publication mechanism YACS is correctly used
blogger.getPost
Read one post.Syntax: blogger.getPost(ignored_appkey, postid, username, password) returns struct
Returns following components:
- dateCreated - date of last edition
- userid - id of last editor
- postid - page id
- content - the actual page content - with 'introduction' and 'source' sub components
blogger.getRecentPosts[/subtitle]
List most recent posts at a given blog.
Syntax: blogger.getRecentPosts(ignored_appkey, blogid, username, password, numberOfPosts) returns array of structs
Returns up to 30 posts of the mentioned section.
Each post has following components:
Returns following components:
dateCreated - date of last editionuserid - id of last editorpostid - page idcontent - the actual page content - with 'introduction' and 'source' sub components
[title]blogger.getTemplate
Read one template.Syntax: blogger.getTemplate(ignored_appkey, blogid, username, password, template_type) returns string
Template type can be either 'main' or 'archiveIndex'.
If the target section does have a template attribute, it is returned to caller. Else a bare and simple template is returned instead.
blogger.getUserInfo[/subtitle]
Get attributes for one user profile
Syntax: blogger.getUserInfo(ignored_appkey, username, password) returns an array
Returns following attributes:
useridfirst name (actually, the nick name)lastname (actually, the full name)email addressweb address
[title]blogger.getUsersBlogs[/subtitle]
List blogs allowed for one user profile.
Assigned sections are listed first, as a convenient mean to access areas with explicit editorial responsibilities.
Then up to 9 top-level sections are listed, with up to 9 sub-sections for each of them.
This provide a hierarchical view of the site map through XML-RPC.
Also, items are numbered to ensure proper sorting of items in w.bloggar.
Syntax: blogger.getUsersBlogs(ignored_appkey, username, password) returns an array
Returns following attributes:
url (of the blog/section)blogidblogname (actually, the section title)
[title]blogger.newPost[/subtitle]
Submit a new post.
Syntax: blogger.newPost(ignored_appkey, blogid, username, password, content, publish) returns string
The content field can include following HTML tags:
source - set the page source, usually, an originating URLintroduction - set the page introduction
If the publish field is set to TRUE, the publication mechanism of YACS is correctly used
[title]blogger.setTemplate
Change one template.Syntax: blogger.setTemplate(ignored_appkey, blogid, username, password, template_content, template_type) returns true or false
Template type can be either 'main' or 'archiveIndex'.
YACS only supports the type 'index'. Other types are silently ignored.
The template is translated as a PHP YACS skin (i.e.,
template.php and skin.php)
and the skin name is section_<blogid>.The provided template text is saved as a section attribute, for later retrieval through calls to
blogger.getTemplate.metaWeblog.editPost
Modify or publish an existing post.Syntax: metaWeblog.editPost(postid, username, password, struct, publish) returns true
Following components of the struct are correctly processed:
- title - set the page title
- source (a sub-component of the 'description' field) - set the page source, usually, an originating URL
- introduction (a sub-component of the 'description' field) - set the page introduction
- description - set the actual page content
- sections - link this page to listed categories
If the publish field is set to TRUE, the publication mechanism YACS is correctly used
metaWeblog.getCategories
List categories for a given blog.Syntax: metaWeblog.getCategories(blogid, username, password) returns struct
In YACS categories are shared at the system level, therefore the blogid parameter is not used. Returns up to 50 YACS categories.
metaWeblog.getPost
Read one post.Syntax: metaWeblog.getPost(postid, username, password) returns struct
Returns following components:
- dateCreated - date of last edition
- userid - id of last editor
- postid - page id
- title - page title
- url - the web address to get the original page
- description - the actual page content - with 'introduction' and 'source' sub components
- author - mail address of the page creator
- comments - the web address to comment the page
metaWeblog.getRecentPosts[/subtitle]
List most recent posts at a given blog.
Syntax: metaWeblog.getRecentPosts(blogid, username, password, numberOfPosts) returns array of structs
Returns up to 30 posts of the mentioned section.
Each post has following components:
dateCreated - date of last editionuserid - id of last editorpostid - page idtitle - page titleurl - the web address to get the original pagedescription - the actual page content - with 'introduction' and 'source' sub componentsauthor - mail address of the page creatorcomments - the web address to comment the page
[title]metaWeblog.newMediaObject
This function is not supported.Upload some file
Syntax: metaWeblog.newMediaObject(blogid, username, password, struct) returns struct
The submitted struct has following attributes:
- name
- type
- bits
The returned structure has only one attribute:
- url (to be used to access uploaded file)
metaWeblog.newPost
Submit a new post.Syntax: metaWeblog.newPost(blogid, username, password, struct, publish) returns string
Following components of the struct are processed:
- title - set the page title
- source (a sub-component of the 'description' field) - set the page source, usually, an originating URL
- introduction (a sub-component of the 'description' field) - set the page introduction
- description - set the actual page content
- categories - link this page to listed categories
If the publish field is set to TRUE, the publication mechanism of YACS is correctly used
This script is a reference file of this system.
Voir aussi:
- Specification for Fault Code Interoperability
- blogger.editPost, from Blogger API 1.0
- blogger.getTemplate from Blogger API 1.0
- blogger.getUserInfo from Blogger API 1.0
- blogger.getUsersBlogs from Blogger API 1.0
- blogger.newPost, from Blogger API 1.0
- blogger.setTemplate from Blogger API 1.0
- services/blog_test.php
- services/configure.php
- http://www.xmlrpc.com/metaWeblogApi
- http://blogs.law.harvard.edu/tech/rss
- Movable Type User Manual: PROGRAMMATIC INTERFACES
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
Testeurs:
- Marcelo L. L. Cabral
- Pat
Reste à faire:
- use section.php for editors