22
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RubyからWordpressに投稿・削除・表示

Posted at
# coding: utf-8
#
require 'time'
require 'xmlrpc/client'

def post
  user = 'admin'
  pass = 'password'
  post = 'post'
  date = Time.parse('2013/07/01 10:00')
  publish = 1 #0:下書き,1:公開 
  description = '内容'

  server = XMLRPC::Client.new('localhost', '/path/to/xmlrpc.php') #/(スラッシュ)は必須

  struct = {
    'title' => 'title',
    'categories' => ['カテゴリ1'],
    'description' => description,
    'dateCreated' => date
  }

  id = server.call("metaWeblog.newPost",1,user,pass,struct,publish)
  puts "Posted ID: #{id}"

  id = server.call("blogger.deletePost", "", id, user, pass, 1)
  puts "delete #{id}"

  id = server.call("blogger.getRecentPosts", "", "", user, pass)
  puts "#{id}"
end

post
  • カテゴリごとの記事一覧はAPIにはなかった。フィードから取れるけど、ページ指定はできるのかな?

Wordpress ruby http://www.mk-mode.com/octopress/2012/06/18/18002033/
http://blog.bungu-do.jp/archives/619
http://lowlevellife.com/2010/10/ruby%E3%81%8B%E3%82%89xmlrpc%E3%81%A7wordpress%E3%81%AB%E6%8A%95%E7%A8%BF/
http://www.kantenna.com/pg/2010/05/wordpressxmlrpc.php

wordpress管理画面以外から http://ameblo.jp/linking/entry-11253888216.html

22
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?