用于连接到 REST API 的 Wordpress 插件? [英] Wordpress plugin to connect to a REST API?

查看:50
本文介绍了用于连接到 REST API 的 Wordpress 插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在某处的服务器上运行了一个 RESTful API,以及一个单独但相关的 Wordpress 站点.

Let's say I have a RESTful API running on a server somewhere, as well as a separate, but related, Wordpress site.

我希望 WP 站点上的一些页面显示从 REST 服务器(以 JSON 格式)检索的 WP 页面上的数据,并允许用户查看和/或编辑 WP 页面上的数据.

I want to have some pages on the WP site that show data on WP pages that has been retrieved from the REST server (in JSON format), and allow the user to view and/or edit the data on WP pages.

例如,假设我有一个 API,作为 REST 的起点,它返回用户拥有的书籍列表.我想显示图书列表,允许用户单击图书链接并转到显示图书详细信息的页面.

For example, let's say I have, as a REST starting point, an API that returns a list of books owned by a user. I want to display the list of books, allow the user to click on a book link and go to a page that displays the details for the book.

然后,如果用户进入编辑模式",它会让他/她编辑数据并通过 REST API POST/PUT 返回到服务器.

Then if the user enters "edit mode", it lets him/her edit the data and POST/PUT it back to the server via the REST API.

是否有任何 WP 插件可以让我创建显示和编辑此类信息的页面?

Is there any WP plugin that lets me create pages that display and edit information like this?

我希望对于每种类型的实体,我都可以输入一些元数据来指示在 JSON 中期望什么以及如何显示它以供查看或如何为其构建表单(例如 iPhorms 可以.

I would expect that for each type of entity I could enter some metadata to indicate what to expect in the JSON and how to display it for viewing or how to build the form for it (like iPhorms does).

推荐答案

因此 WordPress 有一些内置的 AJAX 查询支持,包括管理面板和面向用户的页面.

So WordPress has some built-in support for AJAX queries, both from the admin panel and in the user-facing pages.

我还不完全了解它是如何工作的,因为我对 WordPress 编码完全陌生,但这似乎是我想要的:

I don't fully understand how it all works yet as I am totally new to WordPress coding, but this seems to be what I want:

http://codex.wordpress.org/AJAX_in_Plugins

感谢 moimikey 提到 WP 的 ajax 能力.

Thanks to moimikey for mentioning WP's ajax ability.

这篇关于用于连接到 REST API 的 Wordpress 插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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