RestApi

#1

Hi Friends,
I am not able to use rest api in my testing application, Can I request you to show me a sample of how to use rest api here.

can we do a small test of adding two numbers, where two number as a input will come as a json in a request from the frontend and we will consume the rest call on another page and return sum in json format to the frontend using rest api.

Kindly help me in this context.
Appreciate for your quick and valuable response.

#2

friends please help me to understand how to do this. I am stuck with this very badly.

#3

@rohit101 This is a very open ended question so it’s hard to tell exactly what you’re asking for. REST APIs can be built many different ways. Can you share if you already have code in place that doesn’t work or if you are simply researching how to start this from scratch.

Lucee has support for REST via an inbuilt REST handler which I’ve not used much. There are also several frameworks out there that provide a more robust method of creating REST APIs such as Taffy or Coldbox. I’m part of team ColdBox and quite familiar with that one.

It’s a little hard to help you however without more information on what you are trying to create, which framework (if any) you are using, and what you’ve tried so far.

1 Like
#4

@bdw429s is spot on per usual.

Creating a fully-featured REST API is easy with the ColdBox Platform . Everything you need for creating routes, working with headers, basic auth, massaging data, and enforcing security comes out of the box. We even have several application templates just for REST, so you can use CommandBox to create your first RESTFul app
https://coldbox.ortusbooks.com/digging-deeper/recipes/building-rest-apis

You’re here because creating REST APIs with the native functionality in ColdFusion 10 and Lucee is verbose, complex, and developer-hostile. Or maybe you’re still on an older version of ColdFusion. You’ve come to the right place.
https://taffy.io/


:point_down: or using the native REST features… probably not all that helpful…