The starter package deploys a MySQL HeatWave DB System on OCI (see earlier posts [1],[2],[3],[4],[5],[6],[7]) and allows the MySQL REST Service mechanically:
The REST Service allows us to supply entry to knowledge with out requiring SQL. It additionally supplies entry to some Gen AI functionalities obtainable in MySQL HeatWave.
Including knowledge to MRS utilizing Visible Studio Code
To have the ability to use the MRS functionalities obtainable in MySQL Shell for Visible Studio Code, we have to grant some privileges to our admin person:
sql> GRANT 'mysql_rest_service_admin' TO 'admin'@'%';
sql> SET DEFAULT ROLE ALL TO 'admin'@'%';
It’s beneficial to shut the connection and reconnect for instant grants.
We’ll use MySQL Shell for Visible Studio Code to create a brand new desk and supply entry to it utilizing MRS.
sql> create database myproject;
sql> use myproject
sql> create desk myrecords (id int unsigned auto_increment major key,
identify varchar(20),
inserted timestamp default current_timestamp);
sql> insert into myrecords (identify) values ('Scott'), ('Miguel'), ('Fred');
First, we have to create a brand new REST Service. There may be already one, nevertheless it’s devoted to HeatWave:

We name our service “MyService” and it’s accessible utilizing the trail /myService:


Then we have to add the schema and the desk to the service:

Because the schema hasn’t been added to the service (we used a shortcut), MySQL Shell asks whether or not we wish to add it. We are saying “sure”:


We additionally must create a person to entry our service. The MySQL App is enabled by default.
sql> create person myrest recognized by 'myrestPassw0rd!';
Accessing knowledge utilizing curl
In our compute occasion, we will attempt to entry our REST service utilizing curl.
We’d like first to create a cookie (essentially the most easy technique with curl):
$ curl -c cookie.txt -k -X POST -H "Content material-Sort: utility/json"
-d '{"username": "myrest",
"password": "myrestPassw0rd!",
"sessionType": "cookie",
"authApp": "MySQL" }'
https://10.0.1.57/myService/authentication/login
{}
$ curl -s -b cookie.txt -k -X GET https://10.0.1.57/myService/myproject/myrecords | jq
{
"objects": [
{
"id": 1,
"name": "Scott",
"links": [
{
"rel": "self",
"href": "/myService/myproject/myrecords/1"
}
],
"inserted": "2025-09-25 09:52:39.000000",
"_metadata": {
"etag": "C1D669130D63FD76C50E617DFA2A1A982DBCFC2B38A7D4E213BD2C8872580A6D"
}
},
{
"id": 2,
"identify": "Fred",
"hyperlinks": [
{
"rel": "self",
"href": "/myService/myproject/myrecords/2"
}
],
"inserted": "2025-09-25 09:52:39.000000",
"_metadata": {
"etag": "3E8174FCE3DBB38F0FA331E36460F9299C950522809213CC41A7AF954D0E83C4"
}
},
{
"id": 3,
"identify": "Miguel",
"hyperlinks": [
{
"rel": "self",
"href": "/myService/myproject/myrecords/3"
}
],
"inserted": "2025-09-25 09:52:39.000000",
"_metadata": {
"etag": "6519AE07EC7874D08071BD5F52209202EDECEE040FF00EDC314C0401CA51E729"
}
}
],
"restrict": 25,
"offset": 0,
"hasMore": false,
"rely": 3,
"hyperlinks": [
{
"rel": "self",
"href": "/myService/myproject/myrecords/"
}
]
}
We are able to additionally specify a single document:
$ curl -s -b cookie.txt -k -X GET
https://10.0.1.57/myService/myproject/myrecords/2 | jq
{
"id": 2,
"identify": "Fred",
"hyperlinks": [
{
"rel": "self",
"href": "/myService/myproject/myrecords/2"
}
],
"inserted": "2025-09-25 09:52:39.000000",
"_metadata": {
"etag": "3E8174FCE3DBB38F0FA331E36460F9299C950522809213CC41A7AF954D0E83C4"
}
}
Verify the video to see the totally different steps in motion:
Utilizing the Consumer SDK
We are able to additionally use the SDK, which may be very easy.
We begin by downloading the SDK of our service:

I would like to make use of the Non-public IP of the MySQL HeatWave occasion and choose Python language for the SDK:


We copy that downloaded folder to our compute occasion, and we have to rename it as sdk:
[laptop]$ scp -r -i key.pem -r myService.mrs.sdk opc@:
[compute]$ mkdir myproject
[compute]$ mv myService.mrs.sdk myproject/sdk
[compute]$ cd myproject
We are able to now create our Python utility:
from sdk.my_service import *
my_service = MyService(verify_tls_cert=False)
async def predominant():
await my_service.authenticate(
username = "myrest",
password = "myrestPassw0rd!",
app = "MySQL",
)
data = await my_service.myproject.myrecords.discover()
for document in data:
print(document.identify)
await my_service.myproject.myrecords.create(knowledge={"identify": "Lenka"})
asyncio.run(predominant())
And we will execute it:
[opc@webserver myproject]$ python3.12 undertaking.py
Scott
Fred
Miguel
Verify the video to see tips on how to use the SDK:
Extra Data about MRS
Conclusion
With the MySQL REST Service deployed by the starter package, you’ve seen how straightforward it’s to reveal knowledge from MySQL HeatWave with out writing a single line of SQL in your utility. Ranging from a easy desk in your database, you granted the correct privileges, printed the schema to MRS, and accessed it securely over HTTPS – first with plain curl, then with a generated Python SDK.
This method offers you a clear, fashionable API layer on prime of your database: good for hackathons, fast prototypes, and microservices that must devour MySQL knowledge or name GenAI options with minimal boilerplate. From right here, you’ll be able to prolong the identical sample to extra advanced schemas, add authentication and authorization guidelines, or generate SDKs in different languages so each a part of your stack can communicate REST to MySQL HeatWave.
