Problem/Motivation

Not all APIs allow GET requests, some prefer the POST method. It could be useful to allow this module to give developers/site editors the opportunity to choose which method to retrieve the JSON to use.

Proposed resolution

Allow users to select different request method from views_json_source query handler plugin options.

User interface changes

A new 'Request method' select element is provided on 'Query settings' and a request body textarea to allow users pass form parameters to the request.

API changes

A new option for 'post' request method is provided, and 'get' is set as default.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joao.ramos.costa created an issue. See original summary.

joao.ramos.costa’s picture

Assigned: joao.ramos.costa » Unassigned
Issue summary: View changes
Status: Active » Needs review

AstonVictor made their first commit to this issue’s fork.

astonvictor’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

astonvictor’s picture

Created and merged a new MR.

You can select the (post/get) method now.
for testing, I created a new @RestResource plugin with both post and get methods that return different data.

astonvictor’s picture

Status: Needs review » Fixed
joao.ramos.costa’s picture

Thanks a lot for the quick review and merging

joao.ramos.costa’s picture

Hi @AstonVictor,
thanks again for maintaining the module.

I now see that the possibility of passing arguments within the body of the POST request in the commit has dropped at commit https://git.drupalcode.org/project/views_json_source/-/merge_requests/6/..., I was already using this in a project so unfortunately I still cannot update to release 2. To make things more difficult, the getRequestResponse method is private and prevents an class override to change the method and thus the request parameters.
Should I open a new issue?

Kind regards,

João.

astonvictor’s picture

Hi @joao.ramos.costa,

merged changes to the 2.0.x branch.
I'll resolve a few tasks more and create a new release. for now, you can use the dev version of the module that contains fixes.

thanks

joao.ramos.costa’s picture

Hi @AstonVictor,

Thanks a lot!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.