Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Report Output
I'm very new to RESTful API concepts, so I just want some feedback/tips on creating my first service. I have created a service using the example services provided as a guide (i.e HTTP_USERS_SERVICES and HTTP_CONTACTS_SERVICES). GET-ting data from a table is coming along smoothly, but where I'm a little stumped is how to handle dynamic content that takes some time to process. For example, if I want to have a report generated that will take some processing time and then send that back in the body to the client, I'm concerned that I will run into "Error 500 - Internal Service Error" because the web server will time out for some of the slower reports.
One thought I had on how to handle this is to have a service that the front end can request the output of an empty record repeatedly. Once the report is done processing, it can be written to the empty record, and the next GET request from the front end client will get the report output, instead of the empty record (null).
I'm sure there may be better and more standard ways to handle this, so please let me know what you think.
One thought I had on how to handle this is to have a service that the front end can request the output of an empty record repeatedly. Once the report is done processing, it can be written to the empty record, and the next GET request from the front end client will get the report output, instead of the empty record (null).
I'm sure there may be better and more standard ways to handle this, so please let me know what you think.
Comments
What kind of report are you creating? That is, are you returning JSON, HTML, PDF, etc.? Is the report user-driven (i.e., you are allowing the user to define the criteria) or do you control this? What is your worst case scenario?
If you simply cannot exercise that level of control, you probably want to run a few worst case scenario tests to see if this is really a potential problem. If it is, then there a few of approaches you can take. What is the UI/client that will be used to call your web service?