GET vs POST Requests

Based on our read of Parse documentation it does not appear possible to make a GET request to our cloud code endpoints. We’d like to make a GET request to take advantage of easier in-browser caching. Is there a workaround that you know of?

Our mobile app only calls cloud code (never directly to db) and POST requests to cloud code work for 99% of our endpoints, but we’d like to use GET requests for the 1% of outlier requests (e.g. show a user’s email inbox so user doesn’t have to wait on endpoint every time they go to their inbox). Appreciate your thoughts.

I just can share the problem. We even name our cloud functions like “getProducts” and “postProducts”, just to make the intention clear.

I’ve just recently changed from creating cloud functions for everything to leaning on the built in methods for most things as much as possible and combining them with before and after hooks. I did this for a few reasons:

  • The requests are much faster
  • As you pointed out, you can get some caching benefits for GET calls
  • I’m writing less code
    • I’ve found I’m leaning more on the platform and less on custom code (again, this means I’m moving faster as most of those mechanisms are well tested, so I’m just moving faster)

Obviously one can’t use them for everything, but for those small outliers, I’m comfortable absorbing the “penality” of using cloud functions.

Obviously I have no idea what you’re building, so take this lightly, but a hack you could try is to use a beforeFind hook to look for a specific header or query param. If it’s present, do some custom stuff and return the result. Again, this could be a bit hacky, but if the stuff your cloud functions is doing isn’t too crazy, this could be a work around?