---
# System prepended metadata

title: Streetlity APIs

---

# Streetlity APIs

# Services
## Common
There APIs are applied to all services

### Create Service
Create new service, the creating service must not existed. Created service will be counted as an unconfirmed service and need to be upvoted to become an offical service.

**Path**: `/service/$service_name/create`

**Method**: `POST`

**Param**:
<pre>
- location (array): include latitude and longitude in location[0] and location[1] perspective.
- address: address of the service, for later using instead of use google api
- note: note about the service
- images (array): path to the driver of the image
- contributor: username of the contributor
</pre>

### Service in range
Get services that are in a specific area

**Path**: `/service/$sevice_name/range`

**Method**: `GET`

**Param**:
<pre>
- location (array): include latitude and longitude in location[0] and location[1] perspective.
- range: radius to find the service
</pre>

### Get a specified service
Get a specified service by providing id of the service

**Path**: `/service/$service_name/`

**Method**: `GET`

**Param**:
<pre>
- id
</pre>

### Get specified service
Get a specified service by the case:
- By id of the service
- By location of the service (lat, lon)
- By address of the service

Case is depend on the input params and have the priority if all params are satisfied: id > location > address

**Path**: `service/$service_name/`

**Method**: `GET`

**Param**:
<pre>
- id (optional) (1): id of the service
- lat (optional) (2): latitude of the service
- lon (optional) (2): lontitude of the service
- address (optional) (3): address of the service
</pre>

## Unconfirmed Service

### Get a specified unconfirmed service
Same as [Service](#get-specified-service), we can get unconfirmed service in the same way

**Path**: `service/$service_name_ucf/`

**Method**: `GET`

**Param**:
<pre>
Same as service
</pre>

### Get mutiples unconfirmed services
**Path**: `service/$service_name_ucf/s`

**Method**: `GET`

**Param**:
<pre>
address: address of the related services
</pre>

**Return**:
<pre>
- Services
</pre>

### Get all unconfirmed service
Get list of unconfirmed services

**Path**: `service/$service_name_ucf/all`

**Method**: `GET`

**Return**:
<pre>
- Services
</pre>

### Get unconfirmed service in range
Get list of unconfirmed services that in a specified radius

**Path**: `service/$service_name_ucf/range`

**Method**: `GET`

**Param**:
<pre>
- location (array): include latitude and longitude in location[0] and location[1] perspective.
- range: radius to find the service
</pre>

### Update service
Update information of a specified service by their own field

**Path**: `service/$service_name/update`

**Method**: `POST`

**Param**:
<pre>
- note (optional)
- 
</pre>
### Upvote service
Upvote an unconfirmed service. When the service reached enough upvote, it will become an offical service.

**Path**: `/service/$service_name_ucf/upvote`

**Method**: `POST`

**Param**:
<pre>
- id: id of the unconfirmed service
- upvote_type (optional): set to "Immediately" to upvote the service immeditately 
</pre>

### Downvote service
Downvote an service. When the service become lower than the confident, it will be come an unconfirmed service.

**Path**: `service/$service_name_ucf/downvote`

**Method**: `POST`

**Param**:
<pre>
- id: id of the service
</pre>
### Get Review
Get a specified review

**Path**: `/service/$service_name/review`

**Method**: `GET`

**Param**:
<pre>
- review_id: id of the review
</pre>

### Create Review
Create a review for a specified service
**Path**: `/service/$service_name/review/create`

**Method**: `POST`

**Param**: 
<pre>
- service_id: id of the reviewing service
- reviewer: user id of the reviewer
- score: the ratio of the review
- body: content of the review
</pre>

### Delete Review
Delete a review by specified id

**Path**: `/service/$service_name/review`

**Method**: `DELETE`

**Param**:
<pre>
- review_id: id of the review
</pre>

### Update Review
Update body of a specified id
**Path**: `/service/$service_name/review`

**Method**: `POST`

**Param**:
<pre>
- review_id: id of the review
- new_body: content that need to be updated
</pre>


### Query Review
Query the review from a specified order

**Path**: `/service/$service_name/review/query`

**Method**: `GET`

**Param**:
<pre>
- service_id: id of the service
- order
</pre>


## Maintenance History
Maintenance history provide methods to get histories which matched with a specified condition

### Get history by id
Return a history by a specified id

**Path**: `/service/maintenance/history/`

**Method**: `GET`

**Param**: 
<pre>
- id: id of the history
</pre>

**Return**:
<pre>
- History
</pre>

### Get histories related to a common user
Return histories that related to a specififed common user

**Path**: `/service/maintenance/history/c`

**Method**: `GET`

**Param**:
<pre>
- common_user: name of the common user
</pre>

**Return**:
<pre>
- Histories
</pre>

### Get histories related to a maintenance user
Return histories that related to a specified maintenance user

**Path**: `/service/maintenance/history/m`

**Method**: `GET`

**Param**:
<pre>
- maintenance_user: name of the maintenance user
</pre>

**Return**:
<pre>
- Histories
</pre>