-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample-requests.sh
More file actions
58 lines (54 loc) · 1.44 KB
/
sample-requests.sh
File metadata and controls
58 lines (54 loc) · 1.44 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
#!/bin/sh
#
# Sample queries using Curl rather than rest-client.py
#
#
# Use localhost & port 5000 if not specified by environment variable REST
#
REST=${REST:-"localhost:5000"}
echo "Send sentences to analyze"
curl -X POST -H "Content-Type: application/json" HTTP://$REST/apiv1/analyze -d@- << __EOF__
{
"model" : "sentiment",
"sentences" : [
"I think this is a good thing",
"This thing sucks",
"I don't like that one"
],
"callback" : {
"url" : "http://localhost:5000",
"data" : { "some": "arbitrary", "data" : "to be returned" }
}
}
__EOF__
echo ""
echo "Waiting for items to be processed...."
sleep 2;
echo "====================="
echo "Dump cache..."
curl -X GET -H "Content-Type: application/json" "HTTP://$REST/apiv1/cache/sentiment"
echo ""
echo "====================="
echo "Retrieve specific sentences"
curl -X GET -H "Content-Type: application/json" HTTP://$REST/apiv1/sentence -d@- << __EOF__
{
"model" : "sentiment",
"sentences" : [
"I think this is a good thing",
"This thing sucks",
"I don't like that one"
]
}
__EOF__
echo ""
echo "====================="
echo "Retrieve non-analyzed sentences along with analyzed sentence"
curl -X GET -H "Content-Type: application/json" HTTP://$REST/apiv1/sentence -d@- << __EOF__
{
"model" : "sentiment",
"sentences" : [
"I don't think this one exists",
"I think this is a good thing"
]
}
__EOF__