Skip to content

Commit 7595861

Browse files
authored
Update README.md
1 parent e81df06 commit 7595861

File tree

1 file changed

+62
-7
lines changed

1 file changed

+62
-7
lines changed

README.md

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,61 @@ The API mainly uses two HTTP methods: `POST` and `GET`. `POST` method is for use
99
### Run
1010
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)
1111

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+
```
1326

27+
Following header must be specified:
28+
```
29+
Content-Type: application/json
30+
```
1431

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:
33+
```
34+
curl -H 'Content-Type: application/json' -d '{
35+
"productId": "3",
36+
"score": 4.5,
37+
"timestamp": 10
38+
}' localhost:8080/users/3/reviews
39+
```
40+
41+
Output:
42+
```
43+
{"productId":"3","score":4.5,"timestamp":"1970-01-01T00:00:00.010+0000","userId":"3"}
44+
```
45+
46+
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:
1767
```
1868
localhost:8080/users/3/recommendations
1969
```
@@ -52,9 +102,14 @@ Output:
52102
```
53103

54104
## Notes
55-
105+
If you want to change the component's source code and insert it into the project, you can follow these steps:
106+
- Clone docker repository: [Recommender Engine - Docker Files](https://github.com/trendyol-data-eng-summer-intern-2019/recom-engine-docker).
107+
- 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.
56111

57112
## Members
58-
- [Sercan Ersoy]()
59-
- [Yasin Uygun]()
60-
- [Oğuzhan Bölükbaş]()
113+
- [Sercan Ersoy](https://github.com/sercanersoy)
114+
- [Yasin Uygun](https://github.com/yasinuygun)
115+
- [Oğuzhan Bölükbaş](https://github.com/oguzhan-bolukbas)

0 commit comments

Comments
 (0)