WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 22 months ago

#10514 new enhancement

Allow plugins to advertise its XML APIs in RSD

Reported by: sirzooro Owned by: josephscott
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: XML-RPC Keywords: has-patch
Focuses: Cc:

Description

It will be nice if plugins could advertise its APIs in RSD.

Attachments (2)

xmlrpc.php.diff (2.3 KB) - added by sirzooro 5 years ago.
xmlrpc.php.2.diff (2.4 KB) - added by sirzooro 4 years ago.
Escape attributes using esc_attr()

Download all attachments as: .zip

Change History (11)

sirzooro5 years ago

comment:1 josephscott5 years ago

  • Cc joseph@… added

I'm curious to know what other APIs besides XML-RPC and AtomPub would plugins likely be using that do discovery via RSD?

comment:2 sirzooro5 years ago

I think of APIs developed for particular plugin only. At this moment plugins can add register new XML RPC methods using xmlrpc_methods hook. Unfortunately the only way to check from outside if blog supports them is to call one of them and check if call succeeded. This is not a problem (except for performance) if plugin provides some kind of "get" method. But if it adds "set" methods only, this approach is not good. Therefore ability to publish these APIs in RSD is a logical next step.

comment:3 westi5 years ago

  • Cc westi added

comment:4 josephscott5 years ago

You can get a list of available XML-RPC methods by calling the system.listMethods XML-RPC method. This returns all of the available XML-RPC methods for that end point, including ones added by a plugin.

comment:5 ryan4 years ago

  • Milestone changed from 2.9 to Future Release

comment:6 follow-up: josephscott4 years ago

I've been thinking about this again. Although the specific use case that was mentioned (adding XML-RPC methods) isn't really applicable there are other cases where using RSD for alternative API discovery powered by plugins would be desirable.

For instance on WordPress.com we advertise the Twitter API in the RSD.

comment:7 in reply to: ↑ 6 westi4 years ago

Replying to josephscott:

I've been thinking about this again. Although the specific use case that was mentioned (adding XML-RPC methods) isn't really applicable there are other cases where using RSD for alternative API discovery powered by plugins would be desirable.

For instance on WordPress.com we advertise the Twitter API in the RSD.

This sounds reasonable.

I wonder if the current patch isn't the best solution.

Would it not be better to have an action/filter just for additive changes?

comment:8 sirzooro4 years ago

I think that current approach gives more flexibility - someone may decide to remove some APIs from RDS.

BTW, I found that it will be good to use esc_attr() - I will upload new patch soon.

sirzooro4 years ago

Escape attributes using esc_attr()

comment:9 markoheijnen22 months ago

I looked at the patch and I do think the current approach is better then do it for additive changes.

I would say change the filter from xmlrpc_apis to rsd_apis because it isn't XML_RPC only. Also passing the XML_RPC url is weird.

Note: See TracTickets for help on using tickets.