BLOG

Hello world, meet RAW

January 11, 2022
   
Tutorial
Posted by Georges Lagardère

Update: Full details including instructional video can be found at https://github.com/raw-labs/hello-world

In this post I am going to explain how to create a “Hello world!” app in RAW with our Data Product Platform. This app is a simple API endpoint which responds to an HTTP GET with the “Hello world!” string in JSON:

https://api.raw-labs.com/hello-world/hello-world

Before creating the actual “Hello world!” application in RAW there are some prerequisites: first you need to own accounts on raw-labs.com and GitHub.com. Then, you need to go to GitHub, install the RAW repository reader app and grant it read access to the repository where you plan to store your “Hello world” app.

Once this done, RAW will be able to synchronize in real time with the content of your repository and deploy your API endpoint according to your configuration and the code you want to run.

Typically, the minimum RAW app will contain a configuration file (.YML), a code file (.RQL) and a README.md file in a folder. Any YAML file found in a folder synchronized with RAW will become an API endpoint. In the example below, hello-world will become the endpoint as in https://somepath/api/hello-world

Typical minimum RAW app folder

RAW Labs provides developers with an extension to Visual Studio Code to facilitate app development.

The piece of code you will write implements one single function returning the “Hello World!” string.

// Hello world Example
// returns a simple string

hello_world() := {
"Hello World!"
}

And the minimal configuration file will look like the following:

raw: 0.9
endpoint: GET
metadata:
    title: Hello world
    description: Hello world example
    tags:
        - helloworld
language: rql
declaration: hello_world
codeFile: hello-world.rql
format: json
security:
   public: true
computeClass: normal
enabled: true

Some fields are obvious, but a few deserve further explanations.

language: rql

This means that the code to be executed is RAW SQL language.

declaration: hello_world

As explained above, the endpoint will be /hello-world but the function triggered by the HTTP GET will be hello_world as declared in the hello-world.rql file.

format: json

The output format is JSON.

security:
public: true

This endpoint is public and doesn’t require any credentials or authorizations to be executed.

computeClass: normal

RAW Labs provides three different computing classes to execute the code. They range from normal to large and extra-large. Computing classes are chosen depending on the complexity of the code and queries and the expected speed of execution. For this simple example, the normal class is the best option.

As soon as you will have committed your files to your GitHub repository the hello-world endpoint will become available and visible in the catalog.

Hello world app available in the catalog

From the RAW Admin console you will be available to check the deployment settings and monitor endpoint usage.

The complete code example is available on GitHub here. Check out the other posts, including passing parameters

Georges Lagardere Sales Director RAW Labs

Georges Lagardère, VP Customer Experience, RAW Labs.

Learn More

Blog

Hello <name> !

Second basic blog post to show how easy it is to make incremental changes, e.g. pass parameters into a function that creates a new API endpoint

VIDEOS

Get Started with RAW: Hello World!

Instructional video to show how to get started with RAW, using a simple Hello World example. Accompanying instructions can also be found on our Developer Site

Blog

Introducing the RAW Data Product Platform

Data Products as a Service: A collaborative DataOps platform as a service for data APIs. Create and Share data faster.

Success

Thank you for your interest. Expect to hear from us soon.

Error

Email address must contain the @ symbol