-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurlCommandsPopulate.cmd
More file actions
113 lines (90 loc) · 6.25 KB
/
curlCommandsPopulate.cmd
File metadata and controls
113 lines (90 loc) · 6.25 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
REM A script to invoke some sample curl commands on a Windows machine
REM against a running container image of the app-specific Gilhari microservice
REM gilhari_onetomany_example:1.0.
REM
REM The responses are recorded in a log file (curl.log).
REM
REM Note that these curl commands use a default mapped port number of 80
REM even though the port number exposed by the app-specific
REM microservice may be different (e.g., 8081) inside the container shell.
REM
REM You may optionally specify a non-default port number as the first
REM command line argument to this script. For example, to spcify a
REM port number of 8899, use the following command:
REM curlCommands 8899
IF %1.==. GOTO DefaultPort
SET port=%1
GOTO Proceed
:DefaultPort
SET port=80
GOTO Proceed
:Proceed
echo ** BEGIN OUTPUT ** > curl.log
echo. >> curl.log
echo. >> curl.log
echo Using PORT number %port% >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Check the health of the Gilhari microservice >> curl.log
curl -X GET "http://localhost:%port%/gilhari/v1/health/check" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Delete all Employee objects to start fresh >> curl.log
curl -X DELETE "http://localhost:%port%/gilhari/v1/Employee" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Delete all Department objects to start fresh >> curl.log
curl -X DELETE "http://localhost:%port%/gilhari/v1/Department" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Insert one HR Department (deptId = 101) object >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Department" -H "Content-Type: application/json" -d "{""entity"":{""deptId"":101,""name"":""HR"",""location"":""New York"",""budget"":500000.00}}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert one (1) Employee object for HR Department (deptId = 101) >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Employee" -H "Content-Type: application/json" -d "{""entity"":{""empId"":201,""firstName"":""John"",""lastName"":""Doe"",""salary"":70000.00,""deptId"":101}}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert multiple (3) Employee objects for HR Department (deptId = 101) >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Employee" -H "Content-Type: application/json" -d "{""entity"":[{""empId"":202,""firstName"":""Jane"",""lastName"":""Smith"",""salary"":75000.00,""deptId"":101},{""empId"":203,""firstName"":""Michael"",""lastName"":""Johnson"",""salary"":80000.00,""deptId"":101},{""empId"":204,""firstName"":""Sarah"",""lastName"":""Brown"",""salary"":72000.00,""deptId"":101}]}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert one IT Department(deptId = 102) object >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Department" -H "Content-Type: application/json" -d "{""entity"":{""deptId"":102,""name"":""IT"",""location"":""San Francisco"",""budget"":750000.00}}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert multiple (2) Employee objects for IT Department(deptId = 102) >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Employee" -H "Content-Type: application/json" -d "{""entity"":[{""empId"":301,""firstName"":""Alice"",""lastName"":""Williams"",""salary"":80000.00,""deptId"":102},{""empId"":302,""firstName"":""Bob"",""lastName"":""Miller"",""salary"":85000.00,""deptId"":102}]}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert multiple (6) more Employee objects for IT Department(deptId = 102) >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Employee" -H "Content-Type: application/json" -d "{""entity"":[{""empId"":303,""firstName"":""Charlie"",""lastName"":""Davis"",""salary"":95000.00,""deptId"":102},{""empId"":304,""firstName"":""David"",""lastName"":""Garcia"",""salary"":90000.00,""deptId"":102},{""empId"":305,""firstName"":""Eve"",""lastName"":""Martinez"",""salary"":92000.00,""deptId"":102},{""empId"":306,""firstName"":""Grace"",""lastName"":""Hernandez"",""salary"":96000.00,""deptId"":102},{""empId"":307,""firstName"":""Henry"",""lastName"":""Lopez"",""salary"":88000.00,""deptId"":102},{""empId"":308,""firstName"":""Isabella"",""lastName"":""Gonzalez"",""salary"":87000.00,""deptId"":102}]}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert one Marketing Department (deptId = 103) object >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Department" -H "Content-Type: application/json" -d "{""entity"":{""deptId"":103,""name"":""Marketing"",""location"":""Los Angeles"",""budget"":600000.00}}"
echo. >> curl.log
echo. >> curl.log
echo ** Insert multiple (5) Employee objects for Marketing Department (deptId = 103) >> curl.log
curl -X POST "http://localhost:%port%/gilhari/v1/Employee" -H "Content-Type: application/json" -d "{""entity"":[{""empId"":401,""firstName"":""Nina"",""lastName"":""Wilson"",""salary"":85000.00,""deptId"":103},{""empId"":402,""firstName"":""Liam"",""lastName"":""Moore"",""salary"":90000.00,""deptId"":103},{""empId"":403,""firstName"":""Olivia"",""lastName"":""Taylor"",""salary"":95000.00,""deptId"":103},{""empId"":404,""firstName"":""Sophia"",""lastName"":""Anderson"",""salary"":88000.00,""deptId"":103},{""empId"":405,""firstName"":""Mason"",""lastName"":""Thomas"",""salary"":91000.00,""deptId"":103}]}"
echo. >> curl.log
echo. >> curl.log
echo ** Shallow Query all Department objects >> curl.log
curl -X GET "http://localhost:%port%/gilhari/v1/Department?deep=false" -H "Content-Type: application/json" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Query all Employee objects with salary greater than 80000>> curl.log
curl -X GET "http://localhost:%port%/gilhari/v1/Employee?filter=salary>80000" -H "Content-Type: application/json" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Query the count of all Employee objects >> curl.log
curl -X GET "http://localhost:%port%/gilhari/v1/Employee/getAggregate?attribute=empId&aggregateType=COUNT" -H "Content-Type: application/json" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** Query the average salary of all Employee objects in Marketing Department (deptId = 103) >> curl.log
curl -X GET "http://localhost:%port%/gilhari/v1/Employee/getAggregate?attribute=salary&filter=deptId=103&aggregateType=AVG" -H "Content-Type: application/json" >> curl.log
echo. >> curl.log
echo. >> curl.log
echo ** END OUTPUT ** >> curl.log
echo. >> curl.log
type curl.log