Help writing first REST API


#1

I have never built a rest service in lucee. Can someone point me in the right direction on getting started. I have come across tafey, not sure if its actively being developed. Or whats the best approach? Seems to be very little recent documentation on rest. Help me get started please.

Thanks.


#2

ColdBox MVC does REST very easily and is quite actively developed. Here’s a getting started guide that will have an API up and running in a couple minutes.

https://coldbox.ortusbooks.com/digging-deeper/recipes/building-rest-apis


#3

I second Brad… I did many REST APIs the “Coldbox way” together with the ColdBox REST Base Handler Module


#4

Hi @nalbee,
I hope this helps a lot for you.


#5

How do you know when you need a ReST API?


#6

If you need to provide an API for developers of other applications to interact with yours, then it has to be ReST.

If you don’t need to provide that feature, then it becomes a design decision. In general if you build your application with ReST APIs then it can scale better in the future because it will make it easier to make it a distributed application, so you have to weigh that against the added resources that will be required in order to implement it that way, and determine if it makes sense for your scenario.


#7

So, right now, the application we are working on is strictly a web-based. Eventually we’d like to have a native app. Would a native app be able to hook into the functions we are currently writing for the web-based version? Would that be an example of a need for a ReST app?


#8

If you’re writing a SPA or native you prob need to use rest.


#9

Right. The native app will communicate with the server through the RESTful API.


#10

Thank you for confirming, I sincerely appreciate it.