Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed soap_v2 style request in JSON-RPC and added event 'api_server_adpter_jsonrpc_run_after' #3444

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

kiatng
Copy link
Collaborator

@kiatng kiatng commented Aug 16, 2023

…pter_jsonrpc_run_after'

Description (*)

This allows soap_v2 style:

$client = new Krixon_JsonRpc_Client($url);
//...
$result = $client->call('magento.info', [$sessionId]); // v2 style
$result = $client->call('call', [$sessionId, 'magento.info', []]); // v1 style

A new event 'api_server_adapter_jsonrpc_run_after' is added. This is useful to log incoming requests and responses.

In one of my projects, I have custom APIs which I need to provide documentation with. I find v2 style is easier for the clients. In v1 style, the method/procedure is always call(), the name of the actual procedure is in the params. In v2 style, it makes more sense because as the name RPC implies, the client call the procedure by name.

@github-actions github-actions bot added the Component: Api PageRelates to Mage_Api label Aug 16, 2023
docs/EVENTS.md Outdated Show resolved Hide resolved
@colinmollenhour
Copy link
Member

Surely the JSONRPC adapter is not already in heavy use, perhaps this should be the only way and not an alternative to avoid higher burdens of documentation for the inferior method?

@kiatng
Copy link
Collaborator Author

kiatng commented Aug 18, 2023

Surely the JSONRPC adapter is not already in heavy use, perhaps this should be the only way and not an alternative to avoid higher burdens of documentation for the inferior method?

For people who want to migrate from SOAP(v1&v2)/XML to JSON-RPC, it's easier for the client if we accept both v1 and v2 style.

Fixed incorrect ver
Copy link
Member

@colinmollenhour colinmollenhour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes for a very clean API! Nice job!👍

@fballiano fballiano merged commit 0500feb into OpenMage:main Aug 21, 2023
15 checks passed
@fballiano fballiano changed the title Allow soap_v2 style request in JSON-RPC and add event 'api_server_ada… Allowed soap_v2 style request in JSON-RPC and added event 'api_server_adpter_jsonrpc_run_after' Aug 21, 2023
@kiatng kiatng deleted the jsonrpc_v2 branch September 5, 2023 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Api PageRelates to Mage_Api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants