Skip to content

Commit e2963d7

Browse files
committed
Add -i flag to curl commands to show response headers
1 parent 695a155 commit e2963d7

File tree

9 files changed

+69
-216
lines changed

9 files changed

+69
-216
lines changed

_includes/running-examples.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The example requests on this page use the _inventory_ collection. If not already
66

77
[source,bash]
88
----
9-
curl -X PUT [INSTANCE-URL]/inventory -H "Authorization: Basic [BASIC-AUTH]"
9+
curl -i -X PUT [INSTANCE-URL]/inventory -H "Authorization: Basic [BASIC-AUTH]"
1010
11-
curl -X POST [INSTANCE-URL]/inventory?wm=upsert -H "Authorization: Basic [BASIC-AUTH]" \
11+
curl -i -X POST [INSTANCE-URL]/inventory?wm=upsert -H "Authorization: Basic [BASIC-AUTH]" \
1212
-d '[
1313
{ "item": "journal", "qty": 25, "size": { "h": 14, "w": 21, "uom": "cm" }, "status": "A" },
1414
{ "item": "notebook", "qty": 50, "size": { "h": 8.5, "w": 11, "uom": "in" }, "status": "A" },

docs/cloud/examples.adoc

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ submitReading();
12181218
curl -i "[INSTANCE-URL]/readings" --data-urlencode "filter={'timestamp':{$gte:'2024-01-15T00:00:00Z'}}" --data-urlencode "sort={timestamp:-1}"
12191219
12201220
# 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 \
12221222
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
12231223
-d '[
12241224
{"$match": {"timestamp": {"$gte": "2024-01-15T00:00:00Z"}}},
@@ -1301,11 +1301,11 @@ Track air quality, weather conditions, and environmental data.
13011301
[source,bash]
13021302
----
13031303
# 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]"
13061306
13071307
# Register monitoring station
1308-
curl -X POST [INSTANCE-URL]/stations \
1308+
curl -i -X POST [INSTANCE-URL]/stations \
13091309
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
13101310
-d '{
13111311
"stationId": "ENV-NYC-001",
@@ -1320,7 +1320,7 @@ curl -X POST [INSTANCE-URL]/stations \
13201320
}'
13211321
13221322
# Submit environmental measurement
1323-
curl -X POST [INSTANCE-URL]/measurements \
1323+
curl -i -X POST [INSTANCE-URL]/measurements \
13241324
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
13251325
-d '{
13261326
"stationId": "ENV-NYC-001",
@@ -1491,12 +1491,12 @@ Create a comprehensive analytics backend for business metrics.
14911491
[source,bash]
14921492
----
14931493
# 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]"
14971497
14981498
# Record sale
1499-
curl -X POST [INSTANCE-URL]/sales \
1499+
curl -i -X POST [INSTANCE-URL]/sales \
15001500
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
15011501
-d '{
15021502
"orderId": "ORD-2024-001",
@@ -1633,7 +1633,7 @@ recordSale();
16331633
[source,bash]
16341634
----
16351635
# Daily sales aggregation
1636-
curl -X POST [INSTANCE-URL]/sales/_aggrs/daily-sales \
1636+
curl -i -X POST [INSTANCE-URL]/sales/_aggrs/daily-sales \
16371637
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
16381638
-d '[
16391639
{"$match": {"date": {"$gte": "2024-01-01T00:00:00Z"}}},
@@ -1647,7 +1647,7 @@ curl -X POST [INSTANCE-URL]/sales/_aggrs/daily-sales \
16471647
]'
16481648
16491649
# 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 \
16511651
-H "Authorization: Basic [BASIC-AUTH]" -H "Content-Type: application/json" \
16521652
-d '[
16531653
{"$unwind": "$items"},
@@ -1767,12 +1767,12 @@ Build a real-time messaging platform with presence and typing indicators.
17671767
[source,bash]
17681768
----
17691769
# 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]"
17731773
17741774
# Create chat room
1775-
curl -X POST https://[instance].restheart.com/rooms \
1775+
curl -i -X POST https://[instance].restheart.com/rooms \
17761776
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
17771777
-d '{
17781778
"name": "General Discussion",
@@ -1788,7 +1788,7 @@ curl -X POST https://[instance].restheart.com/rooms \
17881788
}'
17891789
17901790
# Send message
1791-
curl -X POST https://[instance].restheart.com/messages \
1791+
curl -i -X POST https://[instance].restheart.com/messages \
17921792
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
17931793
-d '{
17941794
"roomId": "general-discussion",
@@ -1805,7 +1805,7 @@ curl -X POST https://[instance].restheart.com/messages \
18051805
[source,bash]
18061806
----
18071807
# 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 \
18091809
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
18101810
-d '{
18111811
"uri": "chat-messages",
@@ -1827,11 +1827,11 @@ Create real-time polls and surveys with live result updates.
18271827
[source,bash]
18281828
----
18291829
# 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]"
18321832
18331833
# Create poll
1834-
curl -X POST https://[instance].restheart.com/questions \
1834+
curl -i -X POST https://[instance].restheart.com/questions \
18351835
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
18361836
-d '{
18371837
"title": "What is your favorite programming language?",
@@ -1850,7 +1850,7 @@ curl -X POST https://[instance].restheart.com/questions \
18501850
}'
18511851
18521852
# Cast vote
1853-
curl -X POST https://[instance].restheart.com/votes \
1853+
curl -i -X POST https://[instance].restheart.com/votes \
18541854
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
18551855
-d '{
18561856
"pollId": "programming-languages-poll",
@@ -1875,12 +1875,12 @@ Configure collections to allow access via the `$unauthenticated` role for users
18751875
[source,bash]
18761876
----
18771877
# 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]"
18811881
18821882
# Configure public read access permissions
1883-
curl -X PUT https://[instance].restheart.com/acl \
1883+
curl -i -X PUT https://[instance].restheart.com/acl \
18841884
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
18851885
-d '{
18861886
"role": "$unauthenticated",
@@ -1894,7 +1894,7 @@ curl -X PUT https://[instance].restheart.com/acl \
18941894
[source,bash]
18951895
----
18961896
# 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 \
18981898
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
18991899
-d '{
19001900
"title": "Platform Maintenance Scheduled",
@@ -1907,7 +1907,7 @@ curl -X POST https://[instance].restheart.com/announcements \
19071907
}'
19081908
19091909
# 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 \
19111911
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
19121912
-d '{
19131913
"name": "City Weather Stations",
@@ -1957,11 +1957,11 @@ Create a knowledge base or documentation system with public read access and cont
19571957
[source,bash]
19581958
----
19591959
# 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]"
19621962
19631963
# 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 \
19651965
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
19661966
-d '{
19671967
"role": "$unauthenticated",
@@ -1972,7 +1972,7 @@ curl -X PUT https://[instance].restheart.com/acl \
19721972
}'
19731973
19741974
# 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 \
19761976
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
19771977
-d '{
19781978
"role": "editor",
@@ -1984,7 +1984,7 @@ curl -X PUT https://[instance].restheart.com/acl \
19841984
}'
19851985
19861986
# Add documentation articles
1987-
curl -X POST https://[instance].restheart.com/docs \
1987+
curl -i -X POST https://[instance].restheart.com/docs \
19881988
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
19891989
-d '{
19901990
"title": "Getting Started Guide",
@@ -2005,15 +2005,15 @@ curl -X POST https://[instance].restheart.com/docs \
20052005
[source,bash]
20062006
----
20072007
# 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 \
20092009
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
20102010
-d '{
20112011
"role": "$unauthenticated",
20122012
"predicate": "method(GET) and path-prefix(/faqs)"
20132013
}'
20142014
20152015
# Add FAQ entries
2016-
curl -X POST https://[instance].restheart.com/faqs \
2016+
curl -i -X POST https://[instance].restheart.com/faqs \
20172017
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
20182018
-d '{
20192019
"question": "How do I reset my password?",
@@ -2035,10 +2035,10 @@ Create a public events system where anyone can view upcoming events.
20352035
[source,bash]
20362036
----
20372037
# 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]"
20392039
20402040
# 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 \
20422042
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
20432043
-d '{
20442044
"role": "$unauthenticated",
@@ -2052,7 +2052,7 @@ curl -X PUT https://[instance].restheart.com/acl \
20522052
}'
20532053
20542054
# Add public events
2055-
curl -X POST https://[instance].restheart.com/events \
2055+
curl -i -X POST https://[instance].restheart.com/events \
20562056
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
20572057
-d '{
20582058
"title": "API Workshop: Building with RESTHeart",
@@ -2098,7 +2098,7 @@ curl "https://[instance].restheart.com/events" --data-urlencode "filter={'startD
20982098
# 2. Never allow write access for $unauthenticated role
20992099
21002100
# 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 \
21022102
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
21032103
-d '{
21042104
"role": "$unauthenticated",
@@ -2125,12 +2125,12 @@ Build a SaaS platform with proper tenant isolation and billing.
21252125
[source,bash]
21262126
----
21272127
# 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]"
21312131
21322132
# Create tenant
2133-
curl -X POST https://[instance].restheart.com/tenants \
2133+
curl -i -X POST https://[instance].restheart.com/tenants \
21342134
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
21352135
-d '{
21362136
"tenantId": "acme-corp",
@@ -2154,7 +2154,7 @@ curl -X POST https://[instance].restheart.com/tenants \
21542154
[source,bash]
21552155
----
21562156
# Track API usage
2157-
curl -X POST https://[instance].restheart.com/usage \
2157+
curl -i -X POST https://[instance].restheart.com/usage \
21582158
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
21592159
-d '{
21602160
"tenantId": "acme-corp",
@@ -2181,7 +2181,7 @@ curl -X POST https://[instance].restheart.com/usage \
21812181
[source,bash]
21822182
----
21832183
# 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 \
21852185
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
21862186
-d '{
21872187
"cachePolicy": {
@@ -2196,15 +2196,15 @@ curl -X PUT https://[instance].restheart.com/products \
21962196
[source,bash]
21972197
----
21982198
# 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 \
22002200
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
22012201
-d '{
22022202
"keys": {"category": 1, "price": -1},
22032203
"options": {"name": "category_price_idx"}
22042204
}'
22052205
22062206
# 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 \
22082208
-H "Authorization: Bearer [token]" -H "Content-Type: application/json" \
22092209
-d '{
22102210
"keys": {"name": "text", "description": "text", "tags": "text"},

docs/configuration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WARNING: *YOU MUST UPDATE THE DEFAULT PASSWORD!* The `admin` role can execute an
1313
To update it, run the following command:
1414

1515
[source,bash]
16-
$ curl -u admin:secret -X PATCH localhost:8080/users/admin -H "Content-Type: application/json" -d '{ "password": "my-strong-password" }'
16+
$ curl -i -u admin:secret -X PATCH localhost:8080/users/admin -H "Content-Type: application/json" -d '{ "password": "my-strong-password" }'
1717

1818
Refer to link:/docs/security/user-management/[User Management] for more information on how to create new users, roles and permissions.
1919

docs/mongodb-graphql/tutorial.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Create the *star-wars-characters* collection. This is where the data will be ins
4141

4242
[source,bash]
4343
----
44-
curl -X PUT [INSTANCE-URL]/star-wars-characters \
44+
curl -i -X PUT [INSTANCE-URL]/star-wars-characters \
4545
-H "Authorization: Basic [BASIC-AUTH]"
4646
----
4747

@@ -76,7 +76,7 @@ Create the *gql-apps* collection. This is where the GraphQL App definition will
7676

7777
[source,bash]
7878
----
79-
curl -X PUT [INSTANCE-URL]/gql-apps \
79+
curl --i X PUT [INSTANCE-URL]/gql-apps \
8080
-H "Authorization: Basic [BASIC-AUTH]"
8181
----
8282

@@ -113,7 +113,7 @@ Create documents in the *star-wars-characters* collection:
113113

114114
[source,bash]
115115
----
116-
curl -X POST [INSTANCE-URL]/star-wars-characters?wm=upsert \
116+
curl -i -X POST [INSTANCE-URL]/star-wars-characters?wm=upsert \
117117
-H "Authorization: Basic [BASIC-AUTH]"
118118
-H "Content-Type: application/json" \
119119
-d '[
@@ -193,7 +193,7 @@ To insert the GraphQL app definition, run the following:
193193

194194
[source,bash]
195195
----
196-
curl -X POST [INSTANCE-URL]/gql-apps?wm=upsert \
196+
curl -i -X POST [INSTANCE-URL]/gql-apps?wm=upsert \
197197
-H "Authorization: Basic [BASIC-AUTH]"
198198
-H "Content-Type: application/json" \
199199
-d @graphql-app-definition.json
@@ -249,7 +249,7 @@ The GraphQL API is ready to use!
249249

250250
[source,bash]
251251
----
252-
curl -X POST [INSTANCE-URL]/graphql/star-wars \
252+
curl -i -X POST [INSTANCE-URL]/graphql/star-wars \
253253
-H "Authorization: Basic [BASIC-AUTH]"
254254
-H "Content-Type: application/graphql" \
255255
-d '{
@@ -353,7 +353,7 @@ fetch('[INSTANCE-URL]/graphql/star-wars', {
353353

354354
[source,bash]
355355
----
356-
curl -X POST [INSTANCE-URL]/graphql/star-wars \
356+
curl -i -X POST [INSTANCE-URL]/graphql/star-wars \
357357
-H "Authorization: Basic [BASIC-AUTH]" \
358358
-H "Content-Type: application/graphql" \
359359
-d '{

docs/mongodb-rest/tutorial.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ To create a new document, use the `POST` method with a JSON body:
243243

244244
[source,bash]
245245
----
246-
curl -X POST [INSTANCE-URL]/inventory \
246+
curl -i -X POST [INSTANCE-URL]/inventory \
247247
-H "Authorization: Basic [BASIC-AUTH]" \
248248
-H "Content-Type: application/json" \
249249
-d '{"item": "newItem", "qty": 10, "size": { "h": 2, "w": 4, "uom": "cm" }, "status": "C"}'
@@ -307,7 +307,7 @@ You can create a document with a specific ID using the `PUT` method with the `?w
307307

308308
[source,bash]
309309
----
310-
curl -X PUT [INSTANCE-URL]/inventory/newDocument?wm=upsert \
310+
curl -i -X PUT [INSTANCE-URL]/inventory/newDocument?wm=upsert \
311311
-H "Authorization: Basic [BASIC-AUTH]" \
312312
-H "Content-Type: application/json" \
313313
-d '{ "item": "yetAnotherItem", "qty": 90, "size": { "h": 3, "w": 4, "uom": "cm" }, "status": "C" }'
@@ -361,7 +361,7 @@ To modify specific properties of an existing document, use the `PATCH` method:
361361

362362
[source,bash]
363363
----
364-
curl -X PATCH [INSTANCE-URL]/inventory/newDocument \
364+
curl -i -X PATCH [INSTANCE-URL]/inventory/newDocument \
365365
-H "Authorization: Basic [BASIC-AUTH]" \
366366
-H "Content-Type: application/json" \
367367
-d '{ "qty": 40, "status": "A", "newProperty": "value" }'

0 commit comments

Comments
 (0)