{"id":1416,"date":"2010-09-17T03:10:32","date_gmt":"2010-09-16T18:10:32","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/archives\/1416"},"modified":"2010-09-17T03:15:08","modified_gmt":"2010-09-16T18:15:08","slug":"wordpresss%e3%81%a7%e5%af%be%e5%bf%9c%e3%81%97%e3%81%a6%e3%81%84%e3%82%8bxml-rpc-api","status":"publish","type":"post","link":"https:\/\/www.moonmile.net\/blog\/archives\/1416","title":{"rendered":"wordpresss\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u308bxml-rpc api"},"content":{"rendered":"<p>\n    wordpress \u306e xml-rpc \u306f\u3001\n<\/p>\n<p>\n    XML-RPC wp &laquo; WordPress Codex<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/XML-RPC_wp\">http:\/\/codex.wordpress.org\/XML-RPC_wp<\/a>\n<\/p>\n<p>\n    \u306b\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u3068\u3053\u308d\u3069\u3053\u308d\u9593\u9055\u3063\u3066\u3044\u307e\u3059\u3002blogid \u306e\u3068\u3053\u308d\u304c\u3001int \u578b\u3068 string \u578b\u304c\u6df7\u5728\u3057\u3066\u3044\u3066\u3001xml-rpc \u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u5b9f\u88c5\u3057\u3066\u304f\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3001\u3063\u3066\u306a\u5177\u5408\u3067\u3059\u3002\n<\/p>\n<p>\n    \u3055\u3066\u3001\u30d6\u30ed\u30b0\u7cfb\u306e xml-rpc \u306f\u3001\u7a2e\u985e\u304c\u8272\u3005\u3042\u3063\u3066\u3001\n<\/p>\n<p>\n    [WordPress] XML-RPC \u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5 | Sun Limited Mt.<br \/>\n    <a href=\"http:\/\/www.syuhari.jp\/blog\/archives\/1373\">http:\/\/www.syuhari.jp\/blog\/archives\/1373<\/a>\n<\/p>\n<p>\n    \u3092\u53c2\u8003\u306b\u3059\u308b\u3068\u3001\n<\/p>\n<ul>\n<li>mt.* \u3067\u59cb\u307e\u308b Movable Type\n    <\/li>\n<li>metaWeblog.* \u3067\u59cb\u307e\u308b MetaWeblog\n    <\/li>\n<li>blogger.* \u3067\u59cb\u307e\u308b&nbsp;Blogger\n    <\/li>\n<li>wp.* \u3067\u59cb\u307e\u308b wordpress\n    <\/li>\n<\/ul>\n<p>\n    \u3068\u69d8\u3005\u3067\u3059\u3002\n<\/p>\n<p>\n    \u4e00\u4f53\u3001\u3069\u308c\u304c\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u306e\u304b\uff1f\u826f\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3001\u7d50\u5c40\u306f\u3001\u30bd\u30fc\u30b9\u3092\u898b\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\n<\/p>\n<p>\n    # \u307e\u3041\u3001\u539f\u70b9\/\u539f\u5178\u306b\u623b\u308b\u3068\u3044\u3046\u3053\u3067\uff57\n<\/p>\n<p>\n    xmlrpc.php \u3092\u305d\u306e\u307e\u307e\u898b\u308b\u3068\u3001133\u884c\u76ee\u3042\u305f\u308a\u304b\u3089\u3001 \u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4e00\u89a7\u304c\u898b\u308c\u307e\u3059\u3002\n<\/p>\n<pre>\n function wp_xmlrpc_server() {\n        $this-&gt;methods = array(\n            \/\/ WordPress API\n            'wp.getUsersBlogs'      =&gt; 'this:wp_getUsersBlogs',\n            'wp.getPage'            =&gt; 'this:wp_getPage',\n            'wp.getPages'           =&gt; 'this:wp_getPages',\n            'wp.newPage'            =&gt; 'this:wp_newPage',\n            'wp.deletePage'         =&gt; 'this:wp_deletePage',\n            'wp.editPage'           =&gt; 'this:wp_editPage',\n            'wp.getPageList'        =&gt; 'this:wp_getPageList',\n            'wp.getAuthors'         =&gt; 'this:wp_getAuthors',\n            'wp.getCategories'      =&gt; 'this:mw_getCategories',      \/\/ Alias\n            'wp.getTags'            =&gt; 'this:wp_getTags',\n            'wp.newCategory'        =&gt; 'this:wp_newCategory',\n            'wp.deleteCategory'     =&gt; 'this:wp_deleteCategory',\n            'wp.suggestCategories'  =&gt; 'this:wp_suggestCategories',\n            'wp.uploadFile'         =&gt; 'this:mw_newMediaObject', \/\/ Alias\n            'wp.getCommentCount'    =&gt; 'this:wp_getCommentCount',\n            'wp.getPostStatusList'  =&gt; 'this:wp_getPostStatusList',\n            'wp.getPageStatusList'  =&gt; 'this:wp_getPageStatusList',\n            'wp.getPageTemplates'   =&gt; 'this:wp_getPageTemplates',\n            'wp.getOptions'         =&gt; 'this:wp_getOptions',\n            'wp.setOptions'         =&gt; 'this:wp_setOptions',\n            'wp.getComment'         =&gt; 'this:wp_getComment',\n            'wp.getComments'        =&gt; 'this:wp_getComments',\n            'wp.deleteComment'      =&gt; 'this:wp_deleteComment',\n            'wp.editComment'        =&gt; 'this:wp_editComment',\n            'wp.newComment'         =&gt; 'this:wp_newComment',\n            'wp.getCommentStatusList' =&gt; 'this:wp_getCommentStatusList',\n\n            \/\/ Blogger API\n            'blogger.getUsersBlogs' =&gt; 'this:blogger_getUsersBlogs',\n            'blogger.getUserInfo' =&gt; 'this:blogger_getUserInfo',\n            'blogger.getPost' =&gt; 'this:blogger_getPost',\n            'blogger.getRecentPosts' =&gt; 'this:blogger_getRecentPosts',\n            'blogger.getTemplate' =&gt; 'this:blogger_getTemplate',\n            'blogger.setTemplate' =&gt; 'this:blogger_setTemplate',\n            'blogger.newPost' =&gt; 'this:blogger_newPost',\n            'blogger.editPost' =&gt; 'this:blogger_editPost',\n            'blogger.deletePost' =&gt; 'this:blogger_deletePost',\n\n            \/\/ MetaWeblog API (with MT extensions to structs)\n            'metaWeblog.newPost' =&gt; 'this:mw_newPost',\n            'metaWeblog.editPost' =&gt; 'this:mw_editPost',\n            'metaWeblog.getPost' =&gt; 'this:mw_getPost',\n            'metaWeblog.getRecentPosts' =&gt; 'this:mw_getRecentPosts',\n            'metaWeblog.getCategories' =&gt; 'this:mw_getCategories',\n            'metaWeblog.newMediaObject' =&gt; 'this:mw_newMediaObject',\n\n            \/\/ MetaWeblog API aliases for Blogger API\n            \/\/ see http:\/\/www.xmlrpc.com\/stories\/storyReader$2460\n            'metaWeblog.deletePost' =&gt; 'this:blogger_deletePost',\n            'metaWeblog.getTemplate' =&gt; 'this:blogger_getTemplate',\n            'metaWeblog.setTemplate' =&gt; 'this:blogger_setTemplate',\n            'metaWeblog.getUsersBlogs' =&gt; 'this:blogger_getUsersBlogs',\n\n            \/\/ MovableType API\n            'mt.getCategoryList' =&gt; 'this:mt_getCategoryList',\n            'mt.getRecentPostTitles' =&gt; 'this:mt_getRecentPostTitles',\n            'mt.getPostCategories' =&gt; 'this:mt_getPostCategories',\n            'mt.setPostCategories' =&gt; 'this:mt_setPostCategories',\n            'mt.supportedMethods' =&gt; 'this:mt_supportedMethods',\n            'mt.supportedTextFilters' =&gt; 'this:mt_supportedTextFilters',\n            'mt.getTrackbackPings' =&gt; 'this:mt_getTrackbackPings',\n            'mt.publishPost' =&gt; 'this:mt_publishPost',\n\n            \/\/ PingBack\n            'pingback.ping' =&gt; 'this:pingback_ping',\n            'pingback.extensions.getPingbacks' =&gt; 'this:pingback_extensions_getPingbacks',\n\n            'demo.sayHello' =&gt; 'this:sayHello',\n            'demo.addTwoNumbers' =&gt; 'this:addTwoNumbers'\n        );\n<\/pre>\n<p>\n    \u4f8b\u3048\u3070\u3001wordpress \u306e\u8a18\u4e8b\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e API \u306f\u3001metaWeblog.getPost \u306a\u306e\u3067\u3001mw_getPost \u30e1\u30bd\u30c3\u30c9\u3092\u898b\u308b\u3068\u3001\n<\/p>\n<p>\n    \u5165\u529b\u5024\u304c\u3053\u3093\u306a\u611f\u3058\n<\/p>\n<pre>\n \/**\n     * Retrieve post.\n     *\n     * @since 1.5.0\n     *\n     * @param array $args Method parameters.\n     * @return array\n     *\/\n    function mw_getPost($args) {\n\n        $this-&gt;escape($args);\n\n        $post_ID     = (int) $args[0];\n        $username  = $args[1];\n        $password   = $args[2];\n<\/pre>\n<p>\n    \u51fa\u529b\u5024\u304c\u3053\u3093\u306a\u611f\u3058\n<\/p>\n<pre>\n         $resp = array(\n                'dateCreated' =&gt; new IXR_Date($post_date),\n                'userid' =&gt; $postdata['post_author'],\n                'postid' =&gt; $postdata['ID'],\n                'description' =&gt; $post['main'],\n                'title' =&gt; $postdata['post_title'],\n                'link' =&gt; $link,\n                'permaLink' =&gt; $link,\n                \/\/ commented out because no other tool seems to use this\n                \/\/        'content' =&gt; $entry['post_content'],\n                'categories' =&gt; $categories,\n                'mt_excerpt' =&gt; $postdata['post_excerpt'],\n                'mt_text_more' =&gt; $post['extended'],\n                'mt_allow_comments' =&gt; $allow_comments,\n                'mt_allow_pings' =&gt; $allow_pings,\n                'mt_keywords' =&gt; $tagnames,\n                'wp_slug' =&gt; $postdata['post_name'],\n                'wp_password' =&gt; $postdata['post_password'],\n                'wp_author_id' =&gt; $author-&gt;ID,\n                'wp_author_display_name'    =&gt; $author-&gt;display_name,\n                'date_created_gmt' =&gt; new IXR_Date($post_date_gmt),\n                'post_status' =&gt; $postdata['post_status'],\n                'custom_fields' =&gt; $this-&gt;get_custom_fields($post_ID),\n                'sticky' =&gt; $sticky\n            );\n\n            if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;\n\n            return $resp;\n<\/pre>\n<p>\n    \u3063\u3066\u306a\u611f\u3058\u3067\u5206\u304b\u308a\u307e\u3059\u3002\n<\/p>\n<p>\n    \u73fe\u5728\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u7248\u3092\u4f5c\u6210\u4e2d\u3002\n<\/p>\n<p>\n    &nbsp;\n<\/p>\n<p>\n    &nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>wordpress \u306e xml-rpc \u306f\u3001 XML-RPC wp &laquo; WordPress Codex http:\/\/codex.wordpress.org\/XML-RPC_wp \u306b\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u3068\u3053\u308d\u3069\u3053\u308d &hellip; <a href=\"https:\/\/www.moonmile.net\/blog\/archives\/1416\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13],"tags":[],"class_list":["post-1416","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/1416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=1416"}],"version-history":[{"count":3,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/1416\/revisions"}],"predecessor-version":[{"id":1419,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/1416\/revisions\/1419"}],"wp:attachment":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=1416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=1416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=1416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}