@@ -107,12 +107,12 @@ createCollections();
107
107
[source,bash]
108
108
----
109
109
# Add categories
110
- curl -i -X POST https:// [INSTANCE-URL]/categories \
110
+ curl -i -X POST [INSTANCE-URL]/categories \
111
111
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
112
112
-d '{"name": "Electronics", "slug": "electronics", "description": "Electronic devices and accessories"}'
113
113
114
114
# Add products
115
- curl -i -X POST https:// [INSTANCE-URL]/products \
115
+ curl -i -X POST [INSTANCE-URL]/products \
116
116
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
117
117
-d '{
118
118
"name": "Wireless Headphones",
@@ -224,16 +224,16 @@ addProduct();
224
224
[source,bash]
225
225
----
226
226
# Search products by name
227
- curl -i "https:// [INSTANCE-URL]/products? filter={'name':{\ $regex:'headphones',\ $options:'i'}}"
227
+ curl -i "[INSTANCE-URL]/products" --data-urlencode " filter={'name':{$regex:'headphones',$options:'i'}}"
228
228
229
229
# Filter by price range
230
- curl "https:// [INSTANCE-URL]/products? filter={'price':{\ $gte:50,\ $lte:150}}"
230
+ curl "[INSTANCE-URL]/products" --data-urlencode " filter={'price':{$gte:50,$lte:150}}"
231
231
232
232
# Get products with low inventory
233
- curl "https:// [INSTANCE-URL]/products? filter={'quantity':{\ $lt:10}}"
233
+ curl "[INSTANCE-URL]/products" --data-urlencode " filter={'quantity':{$lt:10}}"
234
234
235
235
# Category-based filtering with sorting
236
- curl "https:// [INSTANCE-URL]/products? filter={'category':'electronics'}& sort={price:1}"
236
+ curl "[INSTANCE-URL]/products" --data-urlencode " filter={'category':'electronics'}" --data-urlencode " sort={price:1}"
237
237
----
238
238
239
239
==== HTTPie
@@ -320,12 +320,12 @@ Create a headless CMS for blogs, news sites, or documentation.
320
320
[source,bash]
321
321
----
322
322
# Create content collections
323
- curl -i -X PUT https:// [INSTANCE-URL]/articles -H "Authorization: Basic [BASIC-AUTH]"
324
- curl -i -X PUT https:// [INSTANCE-URL]/authors -H "Authorization: Basic [BASIC-AUTH]"
325
- curl -i -X PUT https:// [INSTANCE-URL]/media.files -H "Authorization: Basic [BASIC-AUTH]"
323
+ curl -i -X PUT [INSTANCE-URL]/articles -H "Authorization: Basic [BASIC-AUTH]"
324
+ curl -i -X PUT [INSTANCE-URL]/authors -H "Authorization: Basic [BASIC-AUTH]"
325
+ curl -i -X PUT [INSTANCE-URL]/media.files -H "Authorization: Basic [BASIC-AUTH]"
326
326
327
327
# Create author
328
- curl -i -X POST https:// [INSTANCE-URL]/authors \
328
+ curl -i -X POST [INSTANCE-URL]/authors \
329
329
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
330
330
-d '{
331
331
"name": "Jane Smith",
@@ -335,7 +335,7 @@ curl -i -X POST https://[INSTANCE-URL]/authors \
335
335
}'
336
336
337
337
# Create article
338
- curl -i -X POST https:// [INSTANCE-URL]/articles \
338
+ curl -i -X POST [INSTANCE-URL]/articles \
339
339
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
340
340
-d '{
341
341
"title": "Getting Started with RESTHeart Cloud",
@@ -499,13 +499,13 @@ createArticle();
499
499
[source,bash]
500
500
----
501
501
# Get published articles
502
- curl "https:// [INSTANCE-URL]/articles? filter={'status':'published'}& sort={publishedAt:-1}"
502
+ curl "[INSTANCE-URL]/articles" --data-urlencode " filter={'status':'published'}" --data-urlencode " sort={publishedAt:-1}"
503
503
504
504
# Get article by slug
505
- curl "https:// [INSTANCE-URL]/articles? filter={'slug':'getting-started-restheart-cloud'}"
505
+ curl "[INSTANCE-URL]/articles" --data-urlencode " filter={'slug':'getting-started-restheart-cloud'}"
506
506
507
507
# Search articles
508
- curl "https:// [INSTANCE-URL]/articles? filter={\ $text:{\ $search:'RESTHeart API'}}"
508
+ curl "[INSTANCE-URL]/articles" --data-urlencode " filter={$text:{$search:'RESTHeart API'}}"
509
509
----
510
510
511
511
==== HTTPie
@@ -579,12 +579,12 @@ Build a complete social platform with users, posts, likes, and real-time feature
579
579
[source,bash]
580
580
----
581
581
# Create social app collections
582
- curl -i -X PUT https:// [INSTANCE-URL]/profiles -H "Authorization: Basic [BASIC-AUTH]"
583
- curl -i -X PUT https:// [INSTANCE-URL]/posts -H "Authorization: Basic [BASIC-AUTH]"
584
- curl -i -X PUT https:// [INSTANCE-URL]/followers -H "Authorization: Basic [BASIC-AUTH]"
582
+ curl -i -X PUT [INSTANCE-URL]/profiles -H "Authorization: Basic [BASIC-AUTH]"
583
+ curl -i -X PUT [INSTANCE-URL]/posts -H "Authorization: Basic [BASIC-AUTH]"
584
+ curl -i -X PUT [INSTANCE-URL]/followers -H "Authorization: Basic [BASIC-AUTH]"
585
585
586
586
# Create user profile
587
- curl -i -X POST https:// [INSTANCE-URL]/profiles \
587
+ curl -i -X POST [INSTANCE-URL]/profiles \
588
588
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
589
589
-d '{
590
590
"username": "johndoe",
@@ -602,7 +602,7 @@ curl -i -X POST https://[INSTANCE-URL]/profiles \
602
602
}'
603
603
604
604
# Create a post
605
- curl -i -X POST https:// [INSTANCE-URL]/posts \
605
+ curl -i -X POST [INSTANCE-URL]/posts \
606
606
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
607
607
-d '{
608
608
"author": "johndoe",
@@ -773,13 +773,13 @@ createPost();
773
773
[source,bash]
774
774
----
775
775
# Get user timeline (posts from followed users)
776
- curl "https:// [INSTANCE-URL]/posts? filter={'author':{\ $in:['user1','user2','user3']}}& sort={createdAt:-1}"
776
+ curl "[INSTANCE-URL]/posts" --data-urlencode " filter={'author':{$in:['user1','user2','user3']}}" --data-urlencode " sort={createdAt:-1}"
777
777
778
778
# Search posts by hashtag
779
- curl "https:// [INSTANCE-URL]/posts? filter={'hashtags':{\ $in:['#api']}}"
779
+ curl "[INSTANCE-URL]/posts" --data-urlencode " filter={'hashtags':{$in:['#api']}}"
780
780
781
781
# Get user's posts
782
- curl "https:// [INSTANCE-URL]/posts? filter={'author':'johndoe'}& sort={createdAt:-1}"
782
+ curl "[INSTANCE-URL]/posts" --data-urlencode " filter={'author':'johndoe'}" --data-urlencode " sort={createdAt:-1}"
783
783
----
784
784
785
785
==== HTTPie
@@ -850,12 +850,12 @@ Create a comprehensive fitness backend with workouts, progress tracking, and goa
850
850
[source,bash]
851
851
----
852
852
# Setup fitness collections
853
- curl -i -X PUT https:// [INSTANCE-URL]/workouts -H "Authorization: Basic [BASIC-AUTH]"
854
- curl -i -X PUT https:// [INSTANCE-URL]/exercises -H "Authorization: Basic [BASIC-AUTH]"
855
- curl -i -X PUT https:// [INSTANCE-URL]/progress -H "Authorization: Basic [BASIC-AUTH]"
853
+ curl -i -X PUT [INSTANCE-URL]/workouts -H "Authorization: Basic [BASIC-AUTH]"
854
+ curl -i -X PUT [INSTANCE-URL]/exercises -H "Authorization: Basic [BASIC-AUTH]"
855
+ curl -i -X PUT [INSTANCE-URL]/progress -H "Authorization: Basic [BASIC-AUTH]"
856
856
857
857
# Add exercise definitions
858
- curl -i -X POST https:// [INSTANCE-URL]/exercises \
858
+ curl -i -X POST [INSTANCE-URL]/exercises \
859
859
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
860
860
-d '{
861
861
"name": "Push-ups",
@@ -867,7 +867,7 @@ curl -i -X POST https://[INSTANCE-URL]/exercises \
867
867
}'
868
868
869
869
# Log workout
870
- curl -i -X POST https:// [INSTANCE-URL]/workouts \
870
+ curl -i -X POST [INSTANCE-URL]/workouts \
871
871
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
872
872
-d '{
873
873
"userId": "user123",
@@ -1046,12 +1046,12 @@ Collect and analyze data from home sensors and devices.
1046
1046
[source,bash]
1047
1047
----
1048
1048
# Create IoT collections
1049
- curl -i -X PUT https:// [INSTANCE-URL]/devices -H "Authorization: Basic [BASIC-AUTH]"
1050
- curl -i -X PUT https:// [INSTANCE-URL]/readings -H "Authorization: Basic [BASIC-AUTH]"
1051
- curl -i -X PUT https:// [INSTANCE-URL]/alerts -H "Authorization: Basic [BASIC-AUTH]"
1049
+ curl -i -X PUT [INSTANCE-URL]/devices -H "Authorization: Basic [BASIC-AUTH]"
1050
+ curl -i -X PUT [INSTANCE-URL]/readings -H "Authorization: Basic [BASIC-AUTH]"
1051
+ curl -i -X PUT [INSTANCE-URL]/alerts -H "Authorization: Basic [BASIC-AUTH]"
1052
1052
1053
1053
# Register device
1054
- curl -i -X POST https:// [INSTANCE-URL]/devices \
1054
+ curl -i -X POST [INSTANCE-URL]/devices \
1055
1055
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1056
1056
-d '{
1057
1057
"deviceId": "temp-sensor-01",
@@ -1064,7 +1064,7 @@ curl -i -X POST https://[INSTANCE-URL]/devices \
1064
1064
}'
1065
1065
1066
1066
# Submit sensor reading
1067
- curl -i -X POST https:// [INSTANCE-URL]/readings \
1067
+ curl -i -X POST [INSTANCE-URL]/readings \
1068
1068
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1069
1069
-d '{
1070
1070
"deviceId": "temp-sensor-01",
@@ -1215,10 +1215,10 @@ submitReading();
1215
1215
[source,bash]
1216
1216
----
1217
1217
# Get recent readings
1218
- curl -i "https:// [INSTANCE-URL]/readings? filter={'timestamp':{\ $gte:'2024-01-15T00:00:00Z'}}& sort={timestamp:-1}"
1218
+ curl -i "[INSTANCE-URL]/readings" --data-urlencode " filter={'timestamp':{$gte:'2024-01-15T00:00:00Z'}}" --data-urlencode " sort={timestamp:-1}"
1219
1219
1220
1220
# Average temperature by location
1221
- curl -X POST https:// [INSTANCE-URL]/readings/_aggrs/avg-temp-by-location \
1221
+ curl -X POST [INSTANCE-URL]/readings/_aggrs/avg-temp-by-location \
1222
1222
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1223
1223
-d '[
1224
1224
{"$match": {"timestamp": {"$gte": "2024-01-15T00:00:00Z"}}},
@@ -1301,11 +1301,11 @@ Track air quality, weather conditions, and environmental data.
1301
1301
[source,bash]
1302
1302
----
1303
1303
# Environmental monitoring setup
1304
- curl -X PUT https:// [INSTANCE-URL]/stations -H "Authorization: Basic [BASIC-AUTH]"
1305
- curl -X PUT https:// [INSTANCE-URL]/measurements -H "Authorization: Basic [BASIC-AUTH]"
1304
+ curl -X PUT [INSTANCE-URL]/stations -H "Authorization: Basic [BASIC-AUTH]"
1305
+ curl -X PUT [INSTANCE-URL]/measurements -H "Authorization: Basic [BASIC-AUTH]"
1306
1306
1307
1307
# Register monitoring station
1308
- curl -X POST https:// [INSTANCE-URL]/stations \
1308
+ curl -X POST [INSTANCE-URL]/stations \
1309
1309
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1310
1310
-d '{
1311
1311
"stationId": "ENV-NYC-001",
@@ -1320,7 +1320,7 @@ curl -X POST https://[INSTANCE-URL]/stations \
1320
1320
}'
1321
1321
1322
1322
# Submit environmental measurement
1323
- curl -X POST https:// [INSTANCE-URL]/measurements \
1323
+ curl -X POST [INSTANCE-URL]/measurements \
1324
1324
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1325
1325
-d '{
1326
1326
"stationId": "ENV-NYC-001",
@@ -1491,12 +1491,12 @@ Create a comprehensive analytics backend for business metrics.
1491
1491
[source,bash]
1492
1492
----
1493
1493
# Business analytics setup
1494
- curl -X PUT https:// [INSTANCE-URL]/sales -H "Authorization: Basic [BASIC-AUTH]"
1495
- curl -X PUT https:// [INSTANCE-URL]/customers -H "Authorization: Basic [BASIC-AUTH]"
1496
- curl -X PUT https:// [INSTANCE-URL]/analytics-products -H "Authorization: Basic [BASIC-AUTH]"
1494
+ curl -X PUT [INSTANCE-URL]/sales -H "Authorization: Basic [BASIC-AUTH]"
1495
+ curl -X PUT [INSTANCE-URL]/customers -H "Authorization: Basic [BASIC-AUTH]"
1496
+ curl -X PUT [INSTANCE-URL]/analytics-products -H "Authorization: Basic [BASIC-AUTH]"
1497
1497
1498
1498
# Record sale
1499
- curl -X POST https:// [INSTANCE-URL]/sales \
1499
+ curl -X POST [INSTANCE-URL]/sales \
1500
1500
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1501
1501
-d '{
1502
1502
"orderId": "ORD-2024-001",
@@ -1633,7 +1633,7 @@ recordSale();
1633
1633
[source,bash]
1634
1634
----
1635
1635
# Daily sales aggregation
1636
- curl -X POST https:// [INSTANCE-URL]/sales/_aggrs/daily-sales \
1636
+ curl -X POST [INSTANCE-URL]/sales/_aggrs/daily-sales \
1637
1637
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1638
1638
-d '[
1639
1639
{"$match": {"date": {"$gte": "2024-01-01T00:00:00Z"}}},
@@ -1647,7 +1647,7 @@ curl -X POST https://[INSTANCE-URL]/sales/_aggrs/daily-sales \
1647
1647
]'
1648
1648
1649
1649
# Top products by revenue
1650
- curl -X POST https:// [INSTANCE-URL]/sales/_aggrs/top-products \
1650
+ curl -X POST [INSTANCE-URL]/sales/_aggrs/top-products \
1651
1651
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
1652
1652
-d '[
1653
1653
{"$unwind": "$items"},
@@ -1936,13 +1936,13 @@ curl -X POST https://[instance].restheart.com/public-datasets \
1936
1936
curl "https://[instance].restheart.com/announcements"
1937
1937
1938
1938
# Get active announcements
1939
- curl "https://[instance].restheart.com/announcements? filter={'expiresAt':{\ $gte:'2024-01-15T00:00:00Z'}}"
1939
+ curl "https://[instance].restheart.com/announcements" --data-urlencode " filter={'expiresAt':{$gte:'2024-01-15T00:00:00Z'}}"
1940
1940
1941
1941
# Browse public datasets
1942
1942
curl "https://[instance].restheart.com/public-datasets"
1943
1943
1944
1944
# Search datasets by category
1945
- curl "https://[instance].restheart.com/public-datasets? filter={'category':'environmental'}"
1945
+ curl "https://[instance].restheart.com/public-datasets" --data-urlencode " filter={'category':'environmental'}"
1946
1946
1947
1947
# Get specific dataset information
1948
1948
curl "https://[instance].restheart.com/public-datasets/city-weather-stations"
@@ -2079,13 +2079,13 @@ curl -X POST https://[instance].restheart.com/events \
2079
2079
# Public users can access these without authentication
2080
2080
2081
2081
# Get upcoming events
2082
- curl "https://[instance].restheart.com/events? sort={startDate:1}"
2082
+ curl "https://[instance].restheart.com/events" --data-urlencode " sort={startDate:1}"
2083
2083
2084
2084
# Filter events by category
2085
- curl "https://[instance].restheart.com/events? filter={'category':'workshop'}"
2085
+ curl "https://[instance].restheart.com/events" --data-urlencode " filter={'category':'workshop'}"
2086
2086
2087
2087
# Get events for a specific date range
2088
- curl "https://[instance].restheart.com/events? filter={'startDate':{\ $gte:'2024-01-20T00:00:00Z',\ $lt:'2024-01-27T00:00:00Z'}}"
2088
+ curl "https://[instance].restheart.com/events" --data-urlencode " filter={'startDate':{$gte:'2024-01-20T00:00:00Z',$lt:'2024-01-27T00:00:00Z'}}"
2089
2089
----
2090
2090
2091
2091
===== Security Considerations for Public Access
0 commit comments