Dynamic rest api endpoint

1,718 views
Skip to first unread message

Rajneesh

unread,
May 16, 2015, 2:00:04 PM5/16/15
to api-...@googlegroups.com
We would like to add new api endpoints to our existing service at the run time like the way api gateway software allow users to add custom route(api endpoints). Need help/suggestions on how to implement this using open source frameworks.
Thank you.
Regards,
Rajneesh

Travis Spencer

unread,
May 18, 2015, 8:29:57 AM5/18/15
to api-...@googlegroups.com
Python - CherryPy
Java - Spark
.NET - Nancy

If not any of those languages, which?

Rajneesh

unread,
May 18, 2015, 2:09:13 PM5/18/15
to api-...@googlegroups.com
Thank you Travis. We are using java, spring framework for our rest api. I tried using Groovy and Jersey and other dynamic languages to implement this feature.
Regards,
Razneesh
Message has been deleted

Travis Spencer

unread,
May 18, 2015, 5:08:00 PM5/18/15
to api-...@googlegroups.com
In that case, dump spring and use Spark. You can combine it with Pico pretty easily to get good IoC. With these in place, adding / removing routes at run-time isn't very hard. Sample to get you started:

https://github.com/travisspencer/stockholm-java-meetup-java-spark-demo/blob/master/src/main/java/java_meetup_spark_demo/Example08/Application.java

This will be a lot better than using a dynamic language IMO. With such languages, each line of code is a time bomb -- you never know which one will explode till run-time.

HTH!

Rajneesh

unread,
May 19, 2015, 8:22:20 AM5/19/15
to api-...@googlegroups.com
Thank you Travis for your valuable suggestion & guidance. I did try Sprakjava (your sample code ) .Very impressive framework.. However I'm not able to figure out how to add/remove  route at the run time (after spark server is up and running ) .Can you share your thoughts? 
Regards,
Rajneesh 

Travis Spencer

unread,
May 20, 2015, 12:47:13 AM5/20/15
to api-...@googlegroups.com
I was gallivanting around the world last week w/ Nordic APIs, so my work has piled up. Otherwise, I would expand that sample to show how this can be done. Suffice it to say, that it _is_ possible. Play with it, and ping me in June if you're still not getting any joy.

Owen Rubel

unread,
May 30, 2015, 1:03:34 PM5/30/15
to api-...@googlegroups.com
You can do it on the fly using api abstraction as well as at runtime. See documentation at Grails API Toolkit as well as my youtube videos from my SpringOne presentation and other presentations.
Reply all
Reply to author
Forward
0 new messages