@@ -1218,7 +1218,7 @@ submitReading();
1218
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 [INSTANCE-URL]/readings/_aggrs/avg-temp-by-location \
1221
+ curl -i - 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 [INSTANCE-URL]/stations -H "Authorization: Basic [BASIC-AUTH]"
1305
- curl -X PUT [INSTANCE-URL]/measurements -H "Authorization: Basic [BASIC-AUTH]"
1304
+ curl -i - X PUT [INSTANCE-URL]/stations -H "Authorization: Basic [BASIC-AUTH]"
1305
+ curl -i - X PUT [INSTANCE-URL]/measurements -H "Authorization: Basic [BASIC-AUTH]"
1306
1306
1307
1307
# Register monitoring station
1308
- curl -X POST [INSTANCE-URL]/stations \
1308
+ curl -i - 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 [INSTANCE-URL]/stations \
1320
1320
}'
1321
1321
1322
1322
# Submit environmental measurement
1323
- curl -X POST [INSTANCE-URL]/measurements \
1323
+ curl -i - 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 [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]"
1494
+ curl -i - X PUT [INSTANCE-URL]/sales -H "Authorization: Basic [BASIC-AUTH]"
1495
+ curl -i - X PUT [INSTANCE-URL]/customers -H "Authorization: Basic [BASIC-AUTH]"
1496
+ curl -i - X PUT [INSTANCE-URL]/analytics-products -H "Authorization: Basic [BASIC-AUTH]"
1497
1497
1498
1498
# Record sale
1499
- curl -X POST [INSTANCE-URL]/sales \
1499
+ curl -i - 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 [INSTANCE-URL]/sales/_aggrs/daily-sales \
1636
+ curl -i - 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 [INSTANCE-URL]/sales/_aggrs/daily-sales \
1647
1647
]'
1648
1648
1649
1649
# Top products by revenue
1650
- curl -X POST [INSTANCE-URL]/sales/_aggrs/top-products \
1650
+ curl -i - 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"},
@@ -1767,12 +1767,12 @@ Build a real-time messaging platform with presence and typing indicators.
1767
1767
[source,bash]
1768
1768
----
1769
1769
# Chat collections
1770
- curl -X PUT https://[instance].restheart.com/rooms -H "Authorization: Bearer [token]"
1771
- curl -X PUT https://[instance].restheart.com/messages -H "Authorization: Bearer [token]"
1772
- curl -X PUT https://[instance].restheart.com/presence -H "Authorization: Bearer [token]"
1770
+ curl -i - X PUT https://[instance].restheart.com/rooms -H "Authorization: Bearer [token]"
1771
+ curl -i - X PUT https://[instance].restheart.com/messages -H "Authorization: Bearer [token]"
1772
+ curl -i - X PUT https://[instance].restheart.com/presence -H "Authorization: Bearer [token]"
1773
1773
1774
1774
# Create chat room
1775
- curl -X POST https://[instance].restheart.com/rooms \
1775
+ curl -i - X POST https://[instance].restheart.com/rooms \
1776
1776
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1777
1777
-d '{
1778
1778
"name": "General Discussion",
@@ -1788,7 +1788,7 @@ curl -X POST https://[instance].restheart.com/rooms \
1788
1788
}'
1789
1789
1790
1790
# Send message
1791
- curl -X POST https://[instance].restheart.com/messages \
1791
+ curl -i - X POST https://[instance].restheart.com/messages \
1792
1792
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1793
1793
-d '{
1794
1794
"roomId": "general-discussion",
@@ -1805,7 +1805,7 @@ curl -X POST https://[instance].restheart.com/messages \
1805
1805
[source,bash]
1806
1806
----
1807
1807
# Create change stream for real-time messages
1808
- curl -X POST https://[instance].restheart.com/_streams/chat-messages \
1808
+ curl -i - X POST https://[instance].restheart.com/_streams/chat-messages \
1809
1809
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1810
1810
-d '{
1811
1811
"uri": "chat-messages",
@@ -1827,11 +1827,11 @@ Create real-time polls and surveys with live result updates.
1827
1827
[source,bash]
1828
1828
----
1829
1829
# Polling collections
1830
- curl -X PUT https://[instance].restheart.com/questions -H "Authorization: Bearer [token]"
1831
- curl -X PUT https://[instance].restheart.com/votes -H "Authorization: Bearer [token]"
1830
+ curl -i - X PUT https://[instance].restheart.com/questions -H "Authorization: Bearer [token]"
1831
+ curl -i - X PUT https://[instance].restheart.com/votes -H "Authorization: Bearer [token]"
1832
1832
1833
1833
# Create poll
1834
- curl -X POST https://[instance].restheart.com/questions \
1834
+ curl -i - X POST https://[instance].restheart.com/questions \
1835
1835
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1836
1836
-d '{
1837
1837
"title": "What is your favorite programming language?",
@@ -1850,7 +1850,7 @@ curl -X POST https://[instance].restheart.com/questions \
1850
1850
}'
1851
1851
1852
1852
# Cast vote
1853
- curl -X POST https://[instance].restheart.com/votes \
1853
+ curl -i - X POST https://[instance].restheart.com/votes \
1854
1854
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1855
1855
-d '{
1856
1856
"pollId": "programming-languages-poll",
@@ -1875,12 +1875,12 @@ Configure collections to allow access via the `$unauthenticated` role for users
1875
1875
[source,bash]
1876
1876
----
1877
1877
# Create public collections for open data
1878
- curl -X PUT https://[instance].restheart.com/public-datasets -H "Authorization: Bearer [token]"
1879
- curl -X PUT https://[instance].restheart.com/announcements -H "Authorization: Bearer [token]"
1880
- curl -X PUT https://[instance].restheart.com/documentation -H "Authorization: Bearer [token]"
1878
+ curl -i - X PUT https://[instance].restheart.com/public-datasets -H "Authorization: Bearer [token]"
1879
+ curl -i - X PUT https://[instance].restheart.com/announcements -H "Authorization: Bearer [token]"
1880
+ curl -i - X PUT https://[instance].restheart.com/documentation -H "Authorization: Bearer [token]"
1881
1881
1882
1882
# Configure public read access permissions
1883
- curl -X PUT https://[instance].restheart.com/acl \
1883
+ curl -i - X PUT https://[instance].restheart.com/acl \
1884
1884
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1885
1885
-d '{
1886
1886
"role": "$unauthenticated",
@@ -1894,7 +1894,7 @@ curl -X PUT https://[instance].restheart.com/acl \
1894
1894
[source,bash]
1895
1895
----
1896
1896
# Add public announcements (admin-only write, public read)
1897
- curl -X POST https://[instance].restheart.com/announcements \
1897
+ curl -i - X POST https://[instance].restheart.com/announcements \
1898
1898
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1899
1899
-d '{
1900
1900
"title": "Platform Maintenance Scheduled",
@@ -1907,7 +1907,7 @@ curl -X POST https://[instance].restheart.com/announcements \
1907
1907
}'
1908
1908
1909
1909
# Add public dataset entry
1910
- curl -X POST https://[instance].restheart.com/public-datasets \
1910
+ curl -i - X POST https://[instance].restheart.com/public-datasets \
1911
1911
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1912
1912
-d '{
1913
1913
"name": "City Weather Stations",
@@ -1957,11 +1957,11 @@ Create a knowledge base or documentation system with public read access and cont
1957
1957
[source,bash]
1958
1958
----
1959
1959
# Create documentation collections
1960
- curl -X PUT https://[instance].restheart.com/docs -H "Authorization: Bearer [token]"
1961
- curl -X PUT https://[instance].restheart.com/faqs -H "Authorization: Bearer [token]"
1960
+ curl -i - X PUT https://[instance].restheart.com/docs -H "Authorization: Bearer [token]"
1961
+ curl -i - X PUT https://[instance].restheart.com/faqs -H "Authorization: Bearer [token]"
1962
1962
1963
1963
# Configure public read access for documentation
1964
- curl -X PUT https://[instance].restheart.com/acl \
1964
+ curl -i - X PUT https://[instance].restheart.com/acl \
1965
1965
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1966
1966
-d '{
1967
1967
"role": "$unauthenticated",
@@ -1972,7 +1972,7 @@ curl -X PUT https://[instance].restheart.com/acl \
1972
1972
}'
1973
1973
1974
1974
# Configure editor write access for documentation
1975
- curl -X PUT https://[instance].restheart.com/acl \
1975
+ curl -i - X PUT https://[instance].restheart.com/acl \
1976
1976
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1977
1977
-d '{
1978
1978
"role": "editor",
@@ -1984,7 +1984,7 @@ curl -X PUT https://[instance].restheart.com/acl \
1984
1984
}'
1985
1985
1986
1986
# Add documentation articles
1987
- curl -X POST https://[instance].restheart.com/docs \
1987
+ curl -i - X POST https://[instance].restheart.com/docs \
1988
1988
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
1989
1989
-d '{
1990
1990
"title": "Getting Started Guide",
@@ -2005,15 +2005,15 @@ curl -X POST https://[instance].restheart.com/docs \
2005
2005
[source,bash]
2006
2006
----
2007
2007
# Configure FAQ collection for public access
2008
- curl -X PUT https://[instance].restheart.com/acl \
2008
+ curl -i - X PUT https://[instance].restheart.com/acl \
2009
2009
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2010
2010
-d '{
2011
2011
"role": "$unauthenticated",
2012
2012
"predicate": "method(GET) and path-prefix(/faqs)"
2013
2013
}'
2014
2014
2015
2015
# Add FAQ entries
2016
- curl -X POST https://[instance].restheart.com/faqs \
2016
+ curl -i - X POST https://[instance].restheart.com/faqs \
2017
2017
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2018
2018
-d '{
2019
2019
"question": "How do I reset my password?",
@@ -2035,10 +2035,10 @@ Create a public events system where anyone can view upcoming events.
2035
2035
[source,bash]
2036
2036
----
2037
2037
# Create events collection
2038
- curl -X PUT https://[instance].restheart.com/events -H "Authorization: Bearer [token]"
2038
+ curl -i - X PUT https://[instance].restheart.com/events -H "Authorization: Bearer [token]"
2039
2039
2040
2040
# Configure public read access for future events only
2041
- curl -X PUT https://[instance].restheart.com/acl \
2041
+ curl -i - X PUT https://[instance].restheart.com/acl \
2042
2042
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2043
2043
-d '{
2044
2044
"role": "$unauthenticated",
@@ -2052,7 +2052,7 @@ curl -X PUT https://[instance].restheart.com/acl \
2052
2052
}'
2053
2053
2054
2054
# Add public events
2055
- curl -X POST https://[instance].restheart.com/events \
2055
+ curl -i - X POST https://[instance].restheart.com/events \
2056
2056
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2057
2057
-d '{
2058
2058
"title": "API Workshop: Building with RESTHeart",
@@ -2098,7 +2098,7 @@ curl "https://[instance].restheart.com/events" --data-urlencode "filter={'startD
2098
2098
# 2. Never allow write access for $unauthenticated role
2099
2099
2100
2100
# Example: Limit fields exposed to public users
2101
- curl -X PUT https://[instance].restheart.com/acl \
2101
+ curl -i - X PUT https://[instance].restheart.com/acl \
2102
2102
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2103
2103
-d '{
2104
2104
"role": "$unauthenticated",
@@ -2125,12 +2125,12 @@ Build a SaaS platform with proper tenant isolation and billing.
2125
2125
[source,bash]
2126
2126
----
2127
2127
# SaaS collections
2128
- curl -X PUT https://[instance].restheart.com/tenants -H "Authorization: Bearer [token]"
2129
- curl -X PUT https://[instance].restheart.com/subscriptions -H "Authorization: Bearer [token]"
2130
- curl -X PUT https://[instance].restheart.com/usage -H "Authorization: Bearer [token]"
2128
+ curl -i - X PUT https://[instance].restheart.com/tenants -H "Authorization: Bearer [token]"
2129
+ curl -i - X PUT https://[instance].restheart.com/subscriptions -H "Authorization: Bearer [token]"
2130
+ curl -i - X PUT https://[instance].restheart.com/usage -H "Authorization: Bearer [token]"
2131
2131
2132
2132
# Create tenant
2133
- curl -X POST https://[instance].restheart.com/tenants \
2133
+ curl -i - X POST https://[instance].restheart.com/tenants \
2134
2134
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2135
2135
-d '{
2136
2136
"tenantId": "acme-corp",
@@ -2154,7 +2154,7 @@ curl -X POST https://[instance].restheart.com/tenants \
2154
2154
[source,bash]
2155
2155
----
2156
2156
# Track API usage
2157
- curl -X POST https://[instance].restheart.com/usage \
2157
+ curl -i - X POST https://[instance].restheart.com/usage \
2158
2158
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2159
2159
-d '{
2160
2160
"tenantId": "acme-corp",
@@ -2181,7 +2181,7 @@ curl -X POST https://[instance].restheart.com/usage \
2181
2181
[source,bash]
2182
2182
----
2183
2183
# Enable caching for frequently accessed data
2184
- curl -X PUT https://[instance].restheart.com/products \
2184
+ curl -i - X PUT https://[instance].restheart.com/products \
2185
2185
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2186
2186
-d '{
2187
2187
"cachePolicy": {
@@ -2196,15 +2196,15 @@ curl -X PUT https://[instance].restheart.com/products \
2196
2196
[source,bash]
2197
2197
----
2198
2198
# Create indexes for better query performance
2199
- curl -X PUT https://[instance].restheart.com/products/_indexes/category-price \
2199
+ curl -i - X PUT https://[instance].restheart.com/products/_indexes/category-price \
2200
2200
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2201
2201
-d '{
2202
2202
"keys": {"category": 1, "price": -1},
2203
2203
"options": {"name": "category_price_idx"}
2204
2204
}'
2205
2205
2206
2206
# Text index for search
2207
- curl -X PUT https://[instance].restheart.com/products/_indexes/text-search \
2207
+ curl -i - X PUT https://[instance].restheart.com/products/_indexes/text-search \
2208
2208
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
2209
2209
-d '{
2210
2210
"keys": {"name": "text", "description": "text", "tags": "text"},
0 commit comments