You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62-7Lines changed: 62 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,61 @@ The API mainly uses two HTTP methods: `POST` and `GET`. `POST` method is for use
9
9
### Run
10
10
This component cannot be run by itself. In order to run this component, all of the project components must be run using `docker-compose`. See [Recommender Engine - Docker Files](https://github.com/trendyol-data-eng-summer-intern-2019/recom-engine-docker)
11
11
12
-
### Making POST Request
12
+
### Making a POST Request
13
+
New review can be posted to the system by invoking `POST` request to the URL **localhost:8080/users/{userId}/reviews**. For example, if you want to post a review for user with id 2, you should send a `POST` request to following URL path:
14
+
```
15
+
localhost:8080/users/{userId}/reviews
16
+
```
17
+
18
+
A request body of the following form must be specified for the `POST` request:
19
+
```
20
+
{
21
+
'productId': [some_alphanumeric_id],
22
+
'score': [some_float_number],
23
+
'timestamp': [some_timestamp_greater_than_zero]
24
+
}
25
+
```
13
26
27
+
Following header must be specified:
28
+
```
29
+
Content-Type: application/json
30
+
```
14
31
15
-
### Making GET Request
16
-
You can retrieve the user specific recommendations by invoking a `GET` request to the URL **localhost:8080/users/{userId}/recommendations**. User id of the user whom recommendations you want to retrieve is given in the URL path. For example, if you want to fetch the recommendations for the user with id 3, you should send a `GET` request to following URL path:
32
+
You can use the following command to post a new review to the system:
You can install `jq` and beautify the output as follows:
47
+
```
48
+
curl -H 'Content-Type: application/json' -d '{
49
+
"productId": "3",
50
+
"score": 4.5,
51
+
"timestamp": 10
52
+
}' localhost:8080/users/3/reviews | jq
53
+
```
54
+
55
+
Output:
56
+
```
57
+
{
58
+
"productId": "3",
59
+
"score": 4.5,
60
+
"timestamp": "1970-01-01T00:00:00.010+0000",
61
+
"userId": "3"
62
+
}
63
+
```
64
+
65
+
### Making a GET Request
66
+
User specific recommendations can be retrieved by invoking a `GET` request to the URL **localhost:8080/users/{userId}/recommendations**. User id of the user whom recommendations you want to retrieve is given in the URL path. For example, if you want to fetch the recommendations for the user with id 3, you should send a `GET` request to following URL path:
17
67
```
18
68
localhost:8080/users/3/recommendations
19
69
```
@@ -52,9 +102,14 @@ Output:
52
102
```
53
103
54
104
## Notes
55
-
105
+
If you want to change the component's source code and insert it into the project, you can follow these steps:
- Clone this repository, change the desired part of the source code.
108
+
- Run `sbt clean assembly` in the root directory of this repository.
109
+
- Move the created jar file `target/scala-2.11/recom-engine-streaming-assembly-0.1.jar` in this repo's root directory to `images/spring-boot/target` in docker repo's root directory.
110
+
- Run `docker-compose up` in the docker repo's root directory.
0 commit comments