BLOG

Hello <name> !

January 12, 2022
   
Tutorial
Posted by Georges Lagardère

This post is a follow up to the “Hello world!” one. It describes the usual next step, the “Hello name!”, passing a name argument and displaying it. Simple.

https://api.raw-labs.com/hello-world/hello-name?name=Joe

As we already have the folder and files structure available, we will implement a new endpoint called hello-name in the original hello-world.rql file and create the hello-name.yml file.

First we add the hello_name function to the code file:

hello_name(name: string) := {
"Hello "+name+" !"
}

By adding this function, we implicitly create a parameter called ‘name’ which becomes part of the query string in the URL endpoint. Then, we need to create the hello-name.yml file which maps the “hello-name” endpoint and binds the hello_name function to it:

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

As soon as the files are pushed on your GitHub repository, the RAW sync app will deploy the new endpoint and make it publicly available. There’s nothing else to do!

The code is available on GitHub.

Georges Lagardere Sales Director RAW Labs

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


Want to learn more?

Learn More

Blog

Hello world, meet RAW

here we show how to use RAW Data Product Platform to create a simple Hello World output

VIDEOS

Olympics Demo Overview

Georges Lagardère shows how easy it is to expose data as an API using a simple Olympics dataset, and then how to modify the code behind the API and iterate quickly.

WHITE PAPERS

RAW Data Product Platform

Read more about our RAW Data Product Platform, including challenges it is designed to solve, and components of the solution