1

My service requirements and business workflows are bit complicated. First, please consider the two different options below.

enter image description here

In my case, the problems going with restful option are

  • In the restful option, basically to distinguish the operation intended, I need to inspect the input payload. So, my controller logic is going to bit ugly.
  • For each of these operation, I need to check for specific roles and permissions. Based on the input payload, I need to check whether the user has the required permission first, rather than having it at the controller method level as we do now in the RPS style.
  • For some operations, I need to check the current status of the order. For example, approving or rejecting an order which is currently in draft status doesn't make sense. Before approving and disapproving, the order should be in pending for approval status. So, I need call DB to check the current status and this will impact the performance.
  • Monitoring and perf profiling are going to very complex with restful option in my case.
  • Trouble shooting production issues going to be complex. Because the input payload needs to logged and inspected. The http verbs needs to be inspected.
  • I don't think restful way is making it simple just because of exposing fewer endpoints. Now, clients of this service has to be given clear documentation explaining what input they have send in order to perform a specific intended action.
  • My service is not a simple content delivery applications with fewer operation. In the future, I may need to support more operations than what I have today.
  • Please don't tell me, I can pass the operation to be performed in the request header. I don't think, it solves all of the above problems.

So, now why should I bother making my service restful?

Anand Dayalan
  • 513
  • 1
  • 5
  • 13
  • I would say mix it. RPC style calls are the correct way to go in plenty of circumstances. The main reason to use rest when possible is if someone is use to the rest of doing things they will have an easier time working with your API – Nick May 18 '16 at 22:10
  • A Restful Web Service is basically a type of RPC, a subset. See [this link](http://stackoverflow.com/questions/3028899/what-is-the-difference-between-remote-procedure-call-and-web-service). I don't think there's a right or wrong answer here. If we were building this today we'd probably use Restful Web Service because we've never done RPC, but we have done Rest. We'd find some way to make it work. You can just stick with RPC since you seem to think it would be better/easier. – HK1 May 19 '16 at 14:05

0 Answers0