I'm developing a backend server for a mobile app using Cherokee + PHP-FPM + MySQL. I'm providing a RESTful API using Luracast Restler 2.
How do you cache dynamic content so that, for example, once a client has requested a list of items through the REST API, this list (in JSON format) is cached for every other client request until the content validity is set to expire? A global cache mechanism for all clients?
Restler 3 final release will have server side caching support built in the framework itself. Currently you have to implement it on your own within the api method
Related
Using Spring Boot, I have tested the method described here to download a csv file by hitting the backend api.
Here the flow is simple: browser <--request/response--> backend api and the response headers (headers.set(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + csvFileName);) set by the backend api are directly interpreted by the browser and so it's straight forward.
But in my actual production environment, I have an API Gateway (ZUUL in my case) between browser and backend api. And I am not sure if the above approach will work when the request/response goes through api-gateway.
Can api-gateway's interpret the response headers and pass the same to the client i.e browser along with the data. Or any additional configuration is required.
Similarly does file uploads going through api-gateway to backend server need any additional consideration.
I received an email saying that JSON-RPC and Global HTTP Batch serving endpoints being discontinued, and that my project on Google Cloud Platform is calling Global HTTP Batch endpoint.
When I check the API dashboard of the project, however, "Google Cloud Storage JSON API" shows no usage for the last 30 days.
Does that mean the project no longer calls this endpoint?
If not (= if there is still a chance that we call this endpoint), how can I see whether a change that I will make to eliminate the call does actually eliminate the call?
If you are using a client from Google to make your request you are no longer calling the Global HTTP Batch endpoint as they have been updated to use the new API specific Batch endpoint.
You can still use the dev tools from your browser to check the request url from your app.
I am trying to load some user data from database to my angular 2 page. I am doing the angular 2 as separate application and using ReST APIs for get data. My back-end is designed using spring and spring boot and maven tool. So when I am using my angular 2 page, is it possible to load my data from spring boot micro services using Ajax call? Angular 2 supporting Ajax call for HTTP request?. If possible, can anyone share any reference link for exploring the Ajax with http request in angular 2?
So when I am using my angular 2 page, is it possible to load my data
from spring boot micro services using Ajax call?
Yes, that's what Angular is built for, single page applications which calls back Restful services for data. Only thing is I wouldn't phrase it as AJAX call (sounds like an old school :) ) I would rather call it as REST service call.
Angular 2 supporting Ajax call for HTTP request?
Yes it does, that's what Angular is built for
If possible, can anyone share any reference link for exploring the
Ajax with http request in angular 2?
Any sample Angular App with a backend will serve as an example. You will be able to find lots of examples by just googling it. Even if I am providing the code here, it will become irrelevant overtime as angular library itself is evolving. So, I would say, wise thing to do is, check their official website (angular.io, not angularjs that's angular 1.X, ancient stuff) and look for http call examples (eg. tour of heroes project).
I have a Single Page Application, and would like to cache some of the public REST API calls. Is it possible to use CloudFront to cache the JSON result of those API calls?
You can point api.yourdomain.com to cloudfront domain. Cloudfront will cache the json response based on your cache control headers.
However, you'll likely have to deal with cross domain issue if your single page app is not served from api.yourdomain.com. Cloudfront supports OPTIONS request which means it should be able to support CORS. You can also enable caching of OPTIONS requests.
http://aws.amazon.com/cloudfront/faqs/#Does_Amazon_CloudFront_cache_POST_responses
Here is my situation:
I am using Symfony2 as a middle layer here, when web client ask for a webpage to Symfony2(the layer), the layer is going to request single/multiple data/image to another backend remote resource server by http, combine them and return to web client.
And I also wish to have caching in order to reduce requests to the backend server.
I found that the ESI has similar manner, however, could I include another server resource in Symfony2?
Is there any proper way to implement this? Thank you!
It depends whether you have Varnish installed in front of Symfony2 or not.
To be clear: Symfony2 ESI Proxy won't call any external resources, and will only call your app's controllers.
Varnish is able to handle the ESI from any sources.