-
Notifications
You must be signed in to change notification settings - Fork 41
/
test.txt
169 lines (127 loc) · 5.32 KB
/
test.txt
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# ---for testing random---
curl -X GET -i http://localhost:800/random-list
curl --get -X GET -i http://localhost:800/random -d lower=50 -d upper=100
curl -X PUT -i http://localhost:800/random -d upper=100 -d lower=10
#---user crud test---
# adding users
curl -X POST -i http://localhost:81/users/1 -d [email protected] -d name=John
curl -X POST -i http://localhost:81/users/2 -d [email protected] -d name=Steve
curl -X POST -i http://localhost:81/users/3 -d [email protected] -d name=Change
# change email of user 3
curl -X PUT -i http://localhost:81/users/3 -d [email protected]
# check the change
curl -X GET -i http://localhost:81/users/3
# delete user 3
curl -X DELETE -i http://localhost:81/users/3
# check if delete works
curl -X GET -i http://localhost:81/users
#---fulltext search---
curl -X PUT -i http://localhost:82/fulltext -d expression="Who has many apples"
curl -X PUT -i http://localhost:82/fulltext -d expression="The apple tree grew in the park"
curl -X PUT -i http://localhost:82/fulltext -d expression="Some apples are green and some are yellow"
curl -X PUT -i http://localhost:82/fulltext -d expression="How many trees are there in this forest"
curl -X GET -i http://localhost:82/search/apples
#---geo location search---
curl -X POST -i http://localhost:83/location \
-d name=Bucharest \
-d lat="26.1496616" \
-d lng="44.4205455"
curl -X GET -i http://localhost:83/location/26.1/44.4
curl -X GET -i http://localhost:83/location/26.1/44.4 -d max_distance==50000
#---Bayesian average---
curl -X POST -i http://localhost:84/item/1 -d name=Hamlet
curl -X POST -i http://localhost:84/item/2 -d name=Cicero
curl -X POST -i http://localhost:84/item/3 -d name=Alfred
curl -X PUT -i http://localhost:84/item/vote/1 -d mark=9 -d userid=1
curl -X PUT -i http://localhost:84/item/vote/2 -d mark=9 -d userid=4
curl -X PUT -i http://localhost:84/item/vote/3 -d mark=7 -d userid=6
curl -X DELETE -i http://localhost:84/item/3
curl -X GET -i http://localhost:84/item/1
curl -X GET -i http://localhost:84/items
#---photo process---
curl -X PUT -F [email protected] -i http://localhost:85/photo/1
curl -X PUT -F [email protected] -i http://localhost:85/photo/2
curl -X GET http://localhost:85/photo/1 -d resize==100 > image1resize.jpeg
curl -X PUT -F [email protected] -i http://localhost:85/photo/similar
curl -X DELETE -i http://localhost:85/photo/2
#---book collection---
curl -X PUT -i http://localhost:86/book/978-1607965503 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"isbn": "978-1607965503",
"name": "Lincoln the Unknown",
"author": "Dale Carnegie",
"publisher": "snowballpublishing",
"nr_available": 5
}'
curl -X PUT -i http://localhost:86/book/9780262529624 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Intro to Computation and Programming using Python",
"isbn": "9780262529624",
"author": "John Guttag",
"publisher": "MIT Press",
"nr_available": 3
}'
curl -X GET -i http://localhost:86/book/9780262529624
curl -X GET -i http://localhost:86/book/9780262529624
curl -X GET http://localhost:86/book -d limit=5 -d offset=0
# borrow book
# will have to create user for this to work
curl -X PUT -i http://localhost:86/borrow/978-1607965503 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"userid": 1,
"isbn": "978-1607965503",
"borrow_date": "2019-12-12T09:32:51.715Z",
"return_date": "2020-02-12T09:32:51.715Z",
"max_return_date": "2020-03-12T09:32:51.715Z"
}'
# list a borrowed book
curl -X GET -i http://localhost:86/borrow/978-1607965503
curl -X PUT -i http://localhost:86/borrow/return/978-1607965503 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"id": "978-1607965503",
"return_date":"2020-02-12T09:32:51.715Z"
}'
curl -X GET -i http://localhost:86/borrow -d limit=5 -d offset=0
#---fastapi user CRUD---
curl -X POST -i http://localhost:88/users/1 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"userid": 1,
"email": "[email protected]"
"name": "John"
}'
curl -X POST -i http://localhost:88/users/3 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"userid": 3,
"email": "[email protected]",
"name": "Change"
}'
curl -X GET -i http://localhost:88/users/2
curl -X PUT -i http://localhost:88/users/3 \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"userid": 3,
"email": "[email protected]",
"name": "Change"
}'
curl -X DELETE -i http://localhost:88/users/1
curl -X GET -i http://localhost:88/users
curl -i -XPOST 'http://localhost:8086/write?db=influx' --data-binary 'humidity value=61'
# mqtt service
# new terminal
mosquitto_pub -h localhost -u some_user -P some_pass -p 1883 -d -t sensors -m "{\"sensor_id\": \"temperature\", \"sensor_value\": 15.2}"
# new terminal for sub
mosquitto_sub -h localhost -u some_user -P some_pass -p 1883 -d -t sensors