---
# System prepended metadata

title: eFood Ratings and Review Service

---

# eFood Ratings and Review Service
These apis deal with customer submitting reviews or ratings against an order. Admin approval of a review is also handled in this service.
In development, cuisine base url : `http://api-dev.evaly.com.bd/efood/api/v1.0.0`

### Can Review

- `Description:`
 This api decides whether a user can submit review against an order. User can only submit review is the order is delivered.  

- `Endpoint` : `/restaurants/users/review/can-review/<invoice_number>`

- `Method` : `GET`

- `Headers` : 
    - `Authorization` : < access token here > 

- `Query Parameters` : `N/A`

- `Request Body` : `N/A`

- `Response Body` :
```json=
{
  "success": true,
  "message": "Review does not exist",
  "detail": {
    "can_review": true
  }
}
```
`message` field contains information whether a review exists or not for the invoice. `detail` field contains the `can_review` option based on which review will be accepted or rejected.

### Get reviews by user with restaurant slug

- `Description:`
 This api shows the list of all the reviews submitted for a restaurant.

- `Endpoint` : `/restaurants/users/reviews/<restaurant_slug>`

- `Method` : `GET`

- `Headers` : `N/A`

- `Query Parameters` : `N/A`

- `Request Body` : `N/A`

- `Response Body` :
```json=
{
  "success": true,
  "meta_data": {
    "count": 1,
    "page_size": 12,
    "next": null,
    "previous": null
  },
  "data": [
    {
      "comment": "test test review",
      "rating": 4,
      "created_at": "2020-12-21T10:31:33.431474Z",
      "created_by": {
        "address": null,
        "username": "01932062088",
        "last_name": "v1",
        "first_name": "Kashfia",
        "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
      }
    }
  ]
}
```
`data` field contains the all the details of the reviews submitted against that restaurant.

### Create restaurant reviews by restaurant slug

- `Description:`
 This api lets a user submit review and rating for a order.

- `Endpoint` : `/restaurants/users/review/<invoice_number>`

- `Method` : `POST`

- `Headers` : 
   - `Authorization` : < access token here > 

- `Query Parameters` : `N/A`

- `Request Body` : 
```json=
{
	"slug": "Mezzan-2-btocb",
	"comment": "some comments",
	"rating": 4,
	"images": [
		"example.com/some.jpg",
		"example.com/some2.jpg"
	],
	"other_ratings": {
		"delivery": {
			"comment": "bad",
			"rating": 3
		}
	}
}
```
- `Response Body` :
```json=
{
  "success": true,
  "data": {
    "id": 10,
    "restaurant": {
      "id": 10,
      "name": "Delight",
      "slug": "Delight-sezfa"
    },
    "created_at": "2020-12-21T10:40:41.199183Z",
    "updated_at": "2020-12-21T10:40:41.199214Z",
    "created_by": {
      "username": "01932062088",
      "address": null,
      "first_name": "Kashfia",
      "last_name": "v1",
      "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
    },
    "updated_by": {
      "username": "01932062088",
      "address": null,
      "first_name": "Kashfia",
      "last_name": "v1",
      "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
    },
    "comment": "some comments",
    "rating": 4,
    "images": [
      "example.com/some.jpg",
      "example.com/some2.jpg"
    ],
    "other_ratings": {
      "delivery": {
        "comment": "bad",
        "rating": 3
      }
    },
    "not_likes": {},
    "misc": {},
    "status": "active",
    "order": 180
  }
}
```
`data` field contains the all the details of the reviews submitted against that restaurant.


### Get restaurant reviews

- `Description:`
 This api lets a user view the reviews and ratings for a restaurant.

- `Endpoint` : `/restaurants/users/reviews/<restaurant_slug>`

- `Method` : `GET`

- `Headers` : `N/A`

- `Query Parameters` : `N/A`

- `Request Body` :  `N/A`

- `Response Body` :
```json=
{
  "success": true,
  "meta_data": {
    "count": 1,
    "page_size": 12,
    "next": null,
    "previous": null
  },
  "data": [
    {
      "comment": "some comments",
      "rating": 4,
      "created_at": "2020-12-21T10:40:41.199183Z",
      "created_by": {
        "address": null,
        "username": "01932062088",
        "last_name": "v1",
        "first_name": "Kashfia",
        "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
      }
    }
  ]
}
```
`data` field contains the all the details of the reviews submitted against that restaurant. 


### Admin get review

- `Description:`
 This api lets an admin view a certain review and rating for a restaurant.

- `Endpoint` : `/restaurants/admin/review/<review_id>`

- `Method` : `GET`

- `Headers` : 
     - `Authorization`: < access token here >

- `Query Parameters` : `N/A`

- `Request Body` :  `N/A`

- `Response Body` :
```json=
{
  "success": true,
  "message": "Status OK",
  "data": {
    "id": 10,
    "restaurant": {
      "id": 10,
      "name": "Delight",
      "slug": "Delight-sezfa"
    },
    "created_at": "2020-12-21T10:40:41.199183Z",
    "updated_at": "2020-12-21T10:40:41.199214Z",
    "created_by": {
      "address": null,
      "username": "01932062088",
      "last_name": "v1",
      "first_name": "Kashfia",
      "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
    },
    "updated_by": {
      "address": null,
      "username": "01932062088",
      "last_name": "v1",
      "first_name": "Kashfia",
      "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
    },
    "comment": "some comments",
    "rating": 4,
    "images": [
      "example.com/some.jpg",
      "example.com/some2.jpg"
    ],
    "other_ratings": {
      "delivery": {
        "rating": 3,
        "comment": "bad"
      }
    },
    "not_likes": {},
    "misc": {},
    "status": "active",
    "order": 180
  }
}
```
`data` field contains the all the details of the submitted review.


### Admin update review

- `Description:`
 This api lets an admin update the status of a certain review and rating for a restaurant.

- `Endpoint` : `/restaurants/admin/review/<review_id>`

- `Method` : `PATCH`

- `Headers` : 
     - `Authorization`: < access token here >

- `Query Parameters` : `N/A`

- `Request Body` : 
```json=
{
	"status": "active"
}
```

- `Response Body` :
```json=
{
  "success": true,
  "message": "Status OK",
  "data": {
    "id": 10,
    "restaurant": {
      "id": 10,
      "name": "Delight",
      "slug": "Delight-sezfa"
    },
    "created_at": "2020-12-21T10:40:41.199183Z",
    "updated_at": "2020-12-21T10:52:06.015747Z",
    "created_by": {
      "address": null,
      "username": "01932062088",
      "last_name": "v1",
      "first_name": "Kashfia",
      "profile_pic_url": "https://images.prothomalo.com/prothomalo-bangla%2F2020-10%2F6e7164ab-2bf3-4b22-8b2e-d728e70d4fee%2Fpolice.png"
    },
    "updated_by": {
      "username": "toma",
      "address": null,
      "first_name": null,
      "last_name": null,
      "profile_pic_url": null
    },
    "comment": "some comments",
    "rating": 4,
    "images": [
      "example.com/some.jpg",
      "example.com/some2.jpg"
    ],
    "other_ratings": {
      "delivery": {
        "rating": 3,
        "comment": "bad"
      }
    },
    "not_likes": {},
    "misc": {},
    "status": "active",
    "order": 180
  }
}
```
`data` field contains the all the details of the submitted review.


### Admin list reviews

- `Description:`
 This api lets an admin view all the reviews and ratings submitted for a restaurant.

- `Endpoint` : `/restaurants/admin/reviews/<restaurant_slug>`

- `Method` : `GET`

- `Headers` : 
    - `Authorization`: < access token here >

- `Query Parameters` : `N/A`

- `Request Body` : `N/A`

- `Response Body` :
```json=
{
  "success": true,
  "meta_data": {
    "count": 3,
    "page_size": 12,
    "next": null,
    "previous": null
  },
  "data": [
    {
      "id": 1,
      "restaurant": {
        "id": 1,
        "name": "Mr. Restaurant",
        "slug": "mr.-restaurant-psoeg"
      },
      "created_at": "2020-11-26T08:54:18.082030Z",
      "updated_at": "2020-11-26T08:54:18.082054Z",
      "created_by": {
        "address": null,
        "username": "01932062088",
        "last_name": "v1",
        "first_name": "Kashfia"
      },
      "updated_by": {
        "address": null,
        "username": "01932062088",
        "last_name": "v1",
        "first_name": "Kashfia"
      },
      "comment": "errreredddddddsss",
      "rating": 4,
      "images": [],
      "other_ratings": {},
      "not_likes": {},
      "misc": {},
      "status": "active",
      "order": 8
    },
    {
      "id": 2,
      "restaurant": {
        "id": 1,
        "name": "Mr. Restaurant",
        "slug": "mr.-restaurant-psoeg"
      },
      "created_at": "2020-12-01T13:32:00.215923Z",
      "updated_at": "2020-12-01T13:32:00.215946Z",
      "created_by": {
        "address": null,
        "username": "01922222222",
        "last_name": "2",
        "first_name": "Kashfia"
      },
      "updated_by": {
        "address": null,
        "username": "01922222222",
        "last_name": "2",
        "first_name": "Kashfia"
      },
      "comment": "okkkkkkkkkkkk",
      "rating": 5,
      "images": [],
      "other_ratings": {},
      "not_likes": {},
      "misc": {},
      "status": "active",
      "order": 48
    },
    {
      "id": 3,
      "restaurant": {
        "id": 1,
        "name": "Mr. Restaurant",
        "slug": "mr.-restaurant-psoeg"
      },
      "created_at": "2020-12-06T09:53:21.461580Z",
      "updated_at": "2020-12-06T09:53:21.461604Z",
      "created_by": {
        "address": null,
        "username": "01311133111",
        "last_name": null,
        "first_name": null
      },
      "updated_by": {
        "address": null,
        "username": "01311133111",
        "last_name": null,
        "first_name": null
      },
      "comment": "Shf uvhn shu sv hawghufhh ",
      "rating": 4,
      "images": [],
      "other_ratings": {},
      "not_likes": {},
      "misc": {},
      "status": "active",
      "order": 63
    }
  ]
}
```
`data` field contains all the details of the submitted reviews.

### Get review summary

- `Description:`
 This api lets a user view the summarized rating of a restaurant.

- `Endpoint` : `/restaurants/users/review-summary/<restaurant_slug>`

- `Method` : `GET`

- `Headers` : `N/A`

- `Query Parameters` : `N/A`

- `Request Body` : `N/A`

- `Response Body` :
```json=
{
  "success": true,
  "data": {
    "star_1": 0,
    "star_2": 0,
    "star_3": 0,
    "star_4": 2,
    "star_5": 1,
    "avg_rating": 4.33,
    "total_ratings": 3
  }
}
```
`data` field contains the total ratings submitted against that restaurant.



