-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurlCommands.sh
More file actions
executable file
·87 lines (67 loc) · 4.3 KB
/
curlCommands.sh
File metadata and controls
executable file
·87 lines (67 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
# A shell script to invoke some sample curl commands on a Linux machine
# against a running container image of the app-specific Gilhari microservice
# gilhari_relationships_implicit_attribs_example:1.0
#
# The responses are recorded in a log file (curl.log).
#
# Note that these curl commands use a mapped port number of 80
# even though the port number exposed by the app-specific
# microservice may be different (e.g., 8081) inside the container shell.
# If you want to use these curl commands from inside the
# container shell on the host machine, you may have to use
# the exposed port number (e.g., 8081) instead.
#
# Note: aId is an IMPLICIT attribute in the B object referenced by the aB attrubute of A
echo -e "** BEGIN OUTPUT **" > curl.log
echo "** Delete all A objects (and their referenced B objects) to start fresh" >> curl.log
curl -X DELETE "http://localhost:80/gilhari/v1/A" >> curl.log
echo "" >> curl.log
echo "** Insert one A object with one referenced B object" >> curl.log
curl -X POST "http://localhost:80/gilhari/v1/A" -H 'Content-Type: application/json' -d '{"entity":{"aId":1,"aString":"aString_1","aBoolean":true,"aFloat":1.1,"aDate":347184000001,"aB":{"bId":100,"bInt":100,"bString":"bString_1"]}}' >> curl.log
echo -e "" >> curl.log
echo "** Query all A objects (and their referenced B objects)" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Shallow Query all A objects (without their referenced B objects)" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A?deep=false" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Insert one A object with one referenced B object" >> curl.log
curl -X POST "http://localhost:80/gilhari/v1/A" -H "Content-Type: application/json" -d '{"entity":{"aId":2,"aString":"aString_2","aBoolean":false,"aFloat":2.2,"aDate":347184000002,"aB":{"bId":200,"bInt":200,"bString":"bString_2"}}}' >> curl.log
echo "" >> curl.log
echo "** Insert one A object without any referenced B objects" >> curl.log
curl -X POST "http://localhost:80/gilhari/v1/A" -H "Content-Type: application/json" -d '{"entity":{"aId":3,"aString":"aString_3","aBoolean":false,"aFloat":3.3,"aDate":347184000003}}' >> curl.log
echo "" >> curl.log
echo "** Query all A objects (and their referenced B objects) objects" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A" -H "Content-Type: application/json"
echo "" >> curl.log
echo "** Shallow Query all A objects (without their referenced B objects)" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A?deep=false" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Query all A objects (and their referenced B objects) objects where aId>1" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A?filter=aId>1" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Query all A objects (and their referenced B objects) objects where the related B object's bInt > 100 (using a path-expression)" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A?filter=jdxObject.aB.bInt>100" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Query the count of A objects" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A/getAggregate?attribute=aId&aggregateType=COUNT" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Query all B objects" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/B" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo ** Delete all B objects >> curl.log
curl -X DELETE "http://localhost:80/gilhari/v1/B" >> curl.log
echo "" >> curl.log
echo "** Query the count of B objects" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/B/getAggregate?attribute=bId&aggregateType=COUNT" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** Delete all A objects (and their referenced B objects)" >> curl.log
curl -X DELETE "http://localhost:80/gilhari/v1/A" >> curl.log
echo "" >> curl.log
echo "** Query the count of all A objects" >> curl.log
curl -X GET "http://localhost:80/gilhari/v1/A/getAggregate?attribute=aId&aggregateType=COUNT" -H "Content-Type: application/json" >> curl.log
echo "" >> curl.log
echo "** END OUTPUT **" >> curl.log
echo "" >> curl.log
cat curl.log