Joomla 3.0 的 REST API [英] REST API for Joomla 3.0

查看:60
本文介绍了Joomla 3.0 的 REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的是 Joomla 3.3.6,需要找到一个 REST API 来访问内容信息、用户信息等.我已经尝试使用以下由 TechJoomla 开发的 REST API,但无法找到有关示例请求、身份验证过程等的适当文档.

I'm currently using the Joomla 3.3.6 and need to find a REST API to access the content information, user information and etc. I already tried to use the following REST API, which is developed by TechJoomla, but unable to find a proper documentation about the sample requests, authentication process and so on.

https://techjoomla.com/rest-api-for-joomla

而且我还考虑了 jbackend REST API,它是作为 joomla 的扩展而开发的,它似乎是一个付费扩展.

And also i considered the jbackend REST API which is developed as an extension for joomla which seems to be a paid extension.

经过大量谷歌搜索后,我仍在努力寻找 REST API 来访问 Joomla 内容.请帮我解决这个问题.

After lot of googling i'm still struggling to find a REST API to access the Joomla content. Please help me with this issue.

先谢谢你.

推荐答案

我也遇到了同样的问题,这就是为什么我最终为 Joomla 3.4.x 开发了一个由 Slim PHP 微框架提供支持的 RESTful API.请注意,这是一个商业 Joomla 包.

I ran into the same issue as well which is why I ended up developing a RESTful API for Joomla 3.4.x, powered by the Slim PHP micro-framework. Please note that this is a commercial Joomla package.

该软件包包括以下内容:

The package includes the following:

  • 服务控制面板组件
  • Joomla服务"附加库,其中包括一个 Slim v2.6.2 版本(以及其他几个库),通过 Composer 获得,通常可以在供应商文件夹中找到.稍后会详细介绍...
  • 服务 Joomla 插件
  • 服务 REST 插件
  • Services Slim 配置插件
  • Slim JSON API 查看插件
  • Slim JSON API 中间件插件

您可能会问,所有这些插件的意义何在?"

You might ask, "What is the point of all these plugins?"

答案是它允许对核心组件的功能进行划分,并为易于扩展的服务路由架构打开大门.请注意,例如,可以使用 Joomla ACL 轻松添加新插件,以限制对这些新路由的访问.

The answer is that it allows for compartmentalization of functionality of the core components and opens the door for an easily extensible services routes architecture. Note that new plugins could easily be added with Joomla ACL restricting access to those new routes, for example.

服务控制面板允许基于每个用户创建令牌(甚至每个 Joomla 用户创建多个令牌).它还允许最终用户配置 Slim 微框架参数,甚至包括 API 速率限制功能的阈值(目前基于每分钟请求数).实际上,这部分非常棒,因为它提供了响应标头中 API 速率阈值状态的实时反馈.

The Services Control Panel allows for creation of tokens on a per-user basis (or even multiple tokens per Joomla user). It also allows the end user to configure the Slim micro-framework parameters and even include a threshold for the API rate-limiting functionality (currently based on requests-per-minute). Actually, that part is totally awesome as it provides live feedback on the state of the API rate threshold within the response header.

cAPI 核心包(cAPI",Constant API"的缩写,因为一切都需要一个产品名称......)就是这样 - 一个 core 包.目前有许多附加组件正在开发中,第一个是安全的 LDAP JSON API(连接到 Microsoft Active Directory),还有更多很酷的附加组件即将推出.

The cAPI Core package ("cAPI", short for "Constant API" because everything needs a product name...) is just that - a core package. There is a host of add-ons currently in development, the first one being a secure LDAP JSON API (which connects to Microsoft Active Directory), with lots more cool add-ons to come.

所有这一切的全部意义在于,基本上,您的请求已得到答复,现在终于有了商业支持的解决方案.此外,我没有重新发明轮子,而是基于一个流行的现有微框架 (Slim) 进行扩展,让开发人员更容易使用核心、可插拔框架进行开发.

The whole point of all this is to say that, basically, your request has been answered and now a commercially supported solution has finally arrived. Plus, instead of reinventing the wheel, I based the extension on a popular, existing micro-framework (Slim), making it easier for developers to work with or develop on the core, pluggable, framework.

因此,您可以在一个易于安装的软件包中充分利用 Joomla(强大的 ACL、高级插件架构、丰富的扩展)和 Sim(经过验证的、符合标准的、成熟的 RESTful PHP 微框架).

So, you get the best of Joomla (robust ACL, advanced plugin architecture, wealth of extensions) and Sim (proven, standards-compliant, mature RESTful PHP micro-framework), all in one easy to install package.

不应掉以轻心通过易于查询的 API 公开网站.我希望任何选择这样做的人都能实现 100% HTTPS 访问并强化他们的服务器的安全性.

Exposing a website via an easily queryable API should not be taken lightly. I would hope anyone choosing to do this would implement 100% HTTPS access and security-harden their server(s).

您可以在此处找到更多信息:http://getcapi.org

You can find more information here: http://getcapi.org

希望这能让你朝着正确的方向前进.

Hope this gets you going in the right direction.

还有一件事:

我再次阅读了您的问题,并阅读了有关您需要访问用户和内容的部分.这些实际上是我研究的第一个服务端点:

I read over your question again and read that part about your need to access users and content. These were actually the first service endpoints I worked on:

/api/v1/user/- 可用于登录和注销用户并在响应中返回已激活的 Joomla 会话- 这也提供了多模式身份验证(通过标头中的令牌或 URL 字符串中的用户名和密码).基本上,它可以满足您的需求.- 您可以像这样强制用户注销:/api/v1/user/logout/username/joomlasessionid

/api/v1/user/ - Can be used to log a user in and out and returns the activated Joomla session in the response - This also provides for multimodal authentication (both via token in header or username & password in URL string). Basically, it works with your needs. - You force a user logout like this: /api/v1/user/logout/username/joomlasessionid

基本上,这是为驱动远程服务或 iOS 或 Android 应用量身定制的.

Basically, this is tailor-made for driving remote services or, say iOS or Android apps.

(GET,POST,PUT,DELETE) /api/v1/content/...

- 提供创建、检索、更新和删除内容的能力

- Provides ability to create, retrieve, update and delete content

(GET,POST,PUT,DELETE) /api/v1/category/...

- 提供创建、检索、更新和删除类​​别的能力

- Provides ability to create, retrieve, update and delete categories

还有,/api/v1/user/login/(用户名)/(密码)

Also, /api/v1/user/login/(username)/(password)

/api/v1/user/logout/(username)/(joomlasessionid)

/api/v1/user/profile

/api/slim/routes

and more...

可以在此处找到有关可用方法的其他信息:

Additional information on available methods can be found here:

http://learn.getcapi.org/api-methods

不用说,所有 cAPI Core 包的改进都包含在年度订阅费中.附加组件(将)单独计费和支持.现在列在 Joomla 扩展目录 (JED) https://extensions.joomla.org/extensions/extension/capi-core-rest-api.

It should go without saying that all cAPI Core package improves are included in the annual subscription fee. Add-ons are (will be) billed and supported separately. Now listed in the Joomla Extensions Directory (JED) https://extensions.joomla.org/extensions/extension/capi-core-rest-api.

更新 2016-03-28

Update 2016-03-28

从 cAPI v1.2.1 开始,已添加新方法以允许 Joomla 用户和组管理的 CRUD.此外,我正在 http://getcapi.io 上开发一个沙箱集群,以允许潜在客户充分测试订阅前的 API 功能.

As of cAPI v1.2.1 new methods have been added to allow CRUD for Joomla user and group management. In addition, I am working on a sandbox cluster at http://getcapi.io to allow potential customers to fully test out the APIs capabilities before subscribing.

更新 2016-09-18

Update 2016-09-18

从 cAPI v1.2.5 开始,已添加新方法以允许对 API 令牌进行 CRUD 操作.API 还更新了可以自动生成 Swagger.json 的 doc-blocks.cAPI 包括后端和前端视图,用于访问 Swagger UI 生成的完整 API 文档.

As of cAPI v1.2.5 new methods have been added to allow CRUD actions on API tokens. The API has also been updated with doc-blocks which can auto-generate a Swagger.json. cAPI includes both a back-end and front-end view for accessing the complete API docs generated by Swagger UI.

最后,https://getcapi.io 以及 demo1.getcapi.io 和 demo2.getcapi.io 现在并允许访问者测试 API 文档.很快,他们将被配置为自动重置,以便将帐户分配给客户,以便他们可以自行全面测试 API.

Finally, https://getcapi.io along with demo1.getcapi.io and demo2.getcapi.io are now live and allow visitors to test the API docs. Soon, they will be configured to auto-reset so that accounts can be distributed to customers so they may fully test the API on their own.

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

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