Skip to main content

Hello World!

API = SQL + YAML + GIT

Meet RAW 😎, the fastest way to turn your data into an API, and share data with customers, partners or colleagues. It's Free to get going and there’s Pro, Business and Enterprise options too.

hello-world.yml:
raw: 0.9
endpoint: GET
metadata:
title: Hello world
description: Hello world!
tags:
– helloworld
language: rql
code: |
SELECT *
FROM [“Hello”, “World!”]
format: json
security:
public: true
computeClass: normal
enabled: true
$ git push hello-world.yml
$ curl https://api.raw-labs.com/hello-world/hello-world
[“Hello”, “World”]

1. Create a SQL function

Query and join Files, Databases and APIs. Manipulate data too.
RAW SQL has power like no other query language. It's like SQL++

iss.rql:
cities := select * from read(“postgres://psql01/world-cities”);
iss := read(“http://api.open-notify.org/iss-now.json”);

iss_cities() := {
SELECT city, lat, lon, distance, country
FROM cities,
sqrt( power(lat – iss.iss_position.latitude),2)+
power(lon – iss.iss_position.longitude),2) as distance
ORDER BY distance asc
LIMIT 3
}

See this and other examples on GitHub

2. Configure with a simple YAML file

Use YAML to control how the API endpoint is configured. Metadata. Resource Groups. Access Scopes and more:

iss-position.yml:
raw: 0.9
endpoint: GET
metadata:
title: ISS city distances
description: Get distance of ISS from closest cities
tags:
– space
– geolocation
language: rql
codeFile: iss.rql
declaration: iss_cities
format: json
security:
public: true
computeClass: normal
enabled: true

3. Push to your Git Repository and start using the API

RAW syncs your repository and provides DataOps and the infrastructure on demand. Create branches and test APIs simply too.

$ git commit -a iss.rql iss-position.yml
$ git push
$ curl https://api.raw-labs.com/examples/1/public/iss/iss-position
[
{ “city”: “Penzance”, “lat”: 50.1190, “lon”: -5.5370, “distance”: 1.70, “country”: “United Kingdom”},
{ “city”: “Saint Ives”, “lat”: 50.2110, “lon”: -5.4800, “distance”: 1.81, “country”: “United Kingdom”},
{ “city”: “Hayle”, “lat”: 50.1830, “lon”: -5.4160, “distance”: 1.83, “country”: “United Kingdom”}
]

Like it ? 😍 - Great! Read on: