docker run --name surrealdb -d -p 8000:8000 surrealdb/surrealdb:latest start --user root --pass root
DATA="INFO FOR DB;"
curl --request POST \
--header "Content-Type: application/json" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
DATA="INFO FOR DB;"
curl --request POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
Insert Data without specific id
DATA="CREATE account SET
name = 'ACME Inc',
created_at = time::now();"
curl -k -L -s --compressed POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
DATA="CREATE author:john SET
name.first = 'John',
name.last = 'Adams',
name.full = string::join(' ', name.first, name.last),
age = 29,
admin = true,
signup_at = time::now();"
curl -k -L -s --compressed POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
DATA="CREATE article SET
created_at = time::now(),
author = author:john,
title = 'Lorem ipsum dolor',
text = 'Donec eleifend, nunc vitae commodo accumsan, mauris est fringilla.',
account = (SELECT id FROM account WHERE name = 'ACME Inc' LIMIT 1);"
curl -k -L -s --compressed POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
DATA="SELECT * FROM article;"
curl -k -L -s --compressed POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
DATA="SELECT * FROM article, account;"
curl -k -L -s --compressed POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql
DATA="SELECT * FROM article WHERE author.age < 30 FETCH author, account;"
curl -k -L -s --compressed POST \
--header "Content-Type: application/json" \
--header "NS: test" \
--header "DB: test" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql