有用于创建从您的网站的API一个字preSS插件? [英] Is there a wordpress plugin for creating an API from your site?

查看:138
本文介绍了有用于创建从您的网站的API一个字preSS插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以API的形式从我的话preSS网站上使用的数据。使用JSON输出也许休息。我不知道是否有任何插件,自动做出这个词preSS的数据来自其上运行的网站外部访问,类似的方式大多数Web API的工作。

I'd like to use the data from my wordpress site in an API form. Maybe REST with JSON output. I'm wondering if there's any plugins that automatically make the wordpress data accessible from outside the site its running on, similar to the way most web APIs work.

推荐答案

字preSS基本上是一个REST动力平台开始。您会进入一个特定的查询字符串(有时埋在'pretty固定链接')的网址,系统基于布局和结构在你的主题定义返回一个半静态的资源。

WordPress is basically a REST-powered platform to begin with. You enter a URL with a particular query string (sometimes buried in a 'pretty permalink') and the system returns a semi-static resource based on the layout and structure defined in your theme.

要建立它变成一个API你需要首先确定你返回哪些信息,以及要如何构建它。你希望人们通过一个典型的链接访问您的数据(HTTP://blog.url/后= XXX和放大器;类别= XXX和放大器;凡是= XXX?)?还是你想继续运行一个典型的博客,但允许通过其他机制API访问?

To build it into an 'API' you'd need to first identify what information you're returning and how you want to structure it. Do you want people to access your data via a typical link (http://blog.url/?post=xxx&category=xxx&whatever=xxx)? Or do you want to keep running a typical blog but allow API access through another mechanism?

如果你想第二条路线,你总是可以挂钩一个插件为内置的XMLPRC服务字preSS。然后用户会做出像 HTTP请求://博客。 ?网址/ xmlrpc.php资源= XXX和放大器;变量= YYY&安培; somethingelse = ZZZ 和您的网站将返回你想要的任何信息(虽然这将是SOAP,REST不是......所以它真的取决于你)。

If you want the second route, you could always hook a plug-in into WordPress' built-in XMLRPC service. Then users will make a request of something like http://blog.url/xmlrpc.php?resource=xxx&variable=yyy&somethingelse=zzz and your site would return whatever information you want (though this would be SOAP, not REST ... so it's really up to you).

请参阅我的答案<一个href=\"http://stackoverflow.com/questions/2751106/is-it-possible-to-extend-word$p$pss-xmlrpc-interface-from-a-plugin/2752042#2752042\">here使用Word preSS code一个具体的例子...

See my answer here for a specific example with WordPress code ...

这篇关于有用于创建从您的网站的API一个字preSS插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆