The Ortus BlogBox

"Ortus: A rise, beginning, coming into being, born, the origin!"

 

 

Category Filtering: 'rest'

 

ColdBox Relax v3.0 Released

Jon Clausen
Apr 11, 2017

 

ColdBox Relax

Coldbox Relax LogoColdBox Relax Moldule v3.0 has been officially released, which includes native support for the OpenAPI/Swagger specification, in addition to a variety of feature upgrades and enhancements.

Version 3.0 makes the OpenAPI/Swagger specification the default documentation format for describing your APIs, while deprecating the Relax programmatic DSL ( scheduled EOL is v4.0 ). In addition, the release includes a complete overhaul of the user interface and Relax API Test Tool, to provide users with a seamless experience for documenting, viewing, testing and exporting in a variety of formats.

ColdBox MVC, Modules, News, REST 0

Making a live edit contact list with Coldbox REST & Vue.js

Scott Steinbeck
Mar 28, 2016

 

Today we will be making a contact database that you can quickly and easily manage using ColdBox and Vue.js. We will be using bootstrap in our project to make it the UI look a little better but it is completely optional if you want to use this in your own project.

For this project I will be using CommandBox to generate all my files.

TL;DR: View the repo here

Lets Begin.

Step 1: You can skip this step if you already have a project set up. 

From CommandBox run:

coldbox create app name=CBVue skeleton=rest --installColdBox

This will give us a minimal project with a handlers\BaseHandler.cfc (needed to make our life easy when creating a REST API) and an handlers\Echo.cfc which is an example usage to get you started.

Now that we have our project started we need to tweak a few things.

First, since this is a template that is expecting to be setup for REST only, the Echo.cfc is set to be the default entry point. Since we want to create a view that accesses a REST API we need to point that to a view.

ColdBox MVC, REST, WireBox 3

REST 2016 - Testing your API with Jasmine

Gavin Pickin
Mar 25, 2016

 

Are you writing APIs? Going to start writing APIs? Now is the time to start testing. Sounds familiar, it should, because you’ll be hearing that a LOT. Do it early, and often, and reap the benefits as the project grows. Whether you are using CFML or not, TestBox is a great way to test your APIs, like I showed you in a previous blog post. Today, we’ll look at Jasmine, and see how you can test your APIs with Javascript… and a couple of “gotchas” I ran into as well.

REST, RoadShow 0

REST2016 - Route Conditions

Luis Majano
Mar 23, 2016

 

Sometimes when you define an incoming API route, you want it to match certain environment or aspect conditions. The addRoute() has an argument called condition, which can be a closure or UDF pointer that must return a boolean and receives the incoming requestString. You can then decide if the route should execute or just be ignored.

So if a route matches via the pattern, then this closure/UDF is called to verify the route with your own custom conditions. This is a great way to create some routes that must match certain environment criterias before they fire. Let's say you only want to fire some routes if they are using FireFox, or a user is logged in, or whatever.

// condition closure
function(requestString){}

// Routing with condition
addRoute(
    pattern="/go/ff", 
    response="

Hello FireFox!

", condition=function(requestString){ return ( findnocase( "Firefox", cgi.HTTP_USER_AGENT ) ? true : false ); } );
Happy Resting!!
ColdBox Connection, ColdBox MVC, REST, RoadShow 0

Building Ionic Apps with ColdBox REST

Scott Steinbeck
Mar 22, 2016

 

Are you ready to enter the exciting world of app building? In today's world, 60% of people are viewing your website on a mobile phone most sites are hard to navigate.  People constantly have to scrolling around and zoom in and out to get all the information. The first option is to make a responsive site which will help but in squishing all your content down into a smaller screen, you lose a lot of the design aspects you spent all your time working on. 

What about a mobile app? Well that's just way too expensive to create, and plus you have to know Objective-C (or Swift) and Java.... Well thanks to some help from our friends at Ionic Framework now you too can create a mobile app without having to learn new languages. Now you can fully customize your user's experience on your site, plus use all of the functionality that is available to the phone. You can easily integrate popular plugins such as the Camera, Geolocation, Contacts, Bluetooth, TouchID, Accelerometer, and much more...

In my Webinar on March 30th I will give a quick overview of Ionic Framework and the Ionic Ecosystem, create a ContentBox REST API, and build an Ionic App that will pull live data from the ContentBox API to display pages and blog posts. 

The link to next week's webinar can be found here:
https://www.ortussolutions.com/blog/coldbox-restful-roadshow-2016-coming-your-way

 

 

ColdBox MVC, ColdFusion, Ionic, REST, RoadShow 0

REST2016 - Testing your API with TestBox

Gavin Pickin
Mar 18, 2016

 

Are you writing APIs? Going to start writing APIs? Now is the time to start testing. Do it early, and often, and reap the benefits as the project grows. TestBox, the defacto CFML test suite, can help your test your API, whether it’s CFML or not.

I will assume you have the basic TextBox installation setup.
 

ColdBox MVC, REST, RoadShow, TestBox 1

REST2016 - Route Responses

Luis Majano
Mar 14, 2016

 

You can route responses inline with ColdBox via the addRoute() function globally in your main routes.cfm template or within any Module as well. This will allow you to build simple response functions or even mock out or stub a RESTFul service very easily. The paremeters you will use for response routing will be: response, statusCode and statusText.

The response argument can be a string or a closure or UDF pointer. The closure and UDF will receive a rc argument which represents the request collection parsed already for you. The simple string can also contain replacement strings that are binded to the parsed parameters from the pattern by using {key} replacements. You can even execute runEvent() within your closure and delegate to whatever event you want instead of auto-routing as well.

// Simple response routing
addRoute( 
    pattern="/users/hello", 
    response="

Hello From RESTLand

", statusCode=200 ); // Simple response routing with placeholders addRoute( pattern="/users/:username", response="

Hello {username} From RESTLand

", statusCode=200 ); // Closure/UDF response routing addRoute( pattern="/users/:username", response=function(rc){ // Do some code here // more code return "

Hello #arguments.rc.username# from RESTLand

"; } ); // Closure/UDF response routing with event support addRoute(pattern="/users/:username", response=function(rc){ // Do some code here // more code return runEvent(event='api:users.data', eventArguments={quickData=true}); });
Happy Resting!!
ColdBox Connection, ColdBox MVC, REST, RoadShow 0

REST2016 - Creating Sub-module URL entry points

Luis Majano
Mar 11, 2016

 

In this entry I will go over how to leverage ColdBox's Modular architecture to RESTFul routing. In ColdBox, every module's ModuleConfig.cfc you create has two important facets for building RESTFul services: 1) The this.entryPoint and the 2) routes structure in the configure() method.

If you are creating ColdBox applications using modules, then you will benefit with the capability to nest entry points so they can match to nested sub-modules. Let's say you have the following module structure:

+modules
  + api
    + security
    + data
ColdBox Connection, ColdBox MVC, REST, RoadShow 0

REST2016 - Introduction to RESTful Tools - Coldbox Relax

Gavin Pickin
Mar 11, 2016

 

ColdBox Relax is a set of restful tools, for lazy experts, that provides an easy way to describe RESTful web services, test RESTful Web Services, monitor RESTful web services, and document your RESTful API.

ColdBox Connection, ColdBox MVC, Relax, REST, RoadShow 0

REST2016 - Versioning Your ColdBox REST API with Modules (Runnable Example)

Brad Wood
Mar 09, 2016

 

In our ColdBox RESTFul RoadShow this month, we've been talking about why ColdBox is the fastest and easiest ways to build a robust REST API in CFML.  One of the very powerful features of the ColdBox MVC Platform is that you can use modules to break your apps and APIs up into management chunks  instead of building a monolith.  Modules also let you decouple pieces of your application so multiple teams can work on different parts.  And with the power of CommandBox's CLI and package manager to assemble your app's dependencies, you can even store modules in a completely separate code repository!   This is exactly what we're going to demo today.

ColdBox Connection, ColdBox MVC, REST, RoadShow, Sample Apps, Tutorials 0
1 2 >>