Form Post to Remote Resource

Answered
Mario Rodrigues asked on September 15, 2018

 Is it possible to make a remote call for JSON data through a form post?  In our current model, we ask the users to specify which fields from the database they want to view and what filters they'd like to apply.  We want to take these parameters and pass it to the remote resource that returns JSON data.  Currently it seems to only support a GET request.  This would require us to either make the form post then return all the JSON data into the browser, or save the resulting JSON data to a file and then call that temporary file in flexmonster.
 
We would like to avoid having to load the entire JSON into the browser as sometimes it can be 20-30MB or making two roundtrips to the server if we have to write the file, then have flexmonster call a separate URL.
 
Is it possible to do a form post to get the remote request?

2 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster September 17, 2018

Hello Mario,
Thank you for your question. Yes, you are right, Flexmonster does not support POST request to load data, only GET request.
However, you can overcome it by making the GET request at an appropriate time. For example, you can make GET request with parameters when the user has already chosen the data fields.
The possible approach can be the following: you can load an empty pivot instance, then ask the user to choose the fields which will be shown. After that, you can call Flexmonster's API call to load the data since you already know what fields need to be included. The recommended API calls here: setReport() and connectTo() . You can choose the one that fits you better.
Please let us know if everything works fine for you.
Regards,
Dmytro

Public
Mario Rodrigues September 17, 2018

Ahh, that makes sense.  Thank you!

Please login or Register to Submit Answer