https://github.com/omarmakled/plista
https://github.com/omarmakled/plista
api microservice mysql
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/omarmakled/plista
- Owner: OmarMakled
- Created: 2019-07-10T15:12:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T13:32:38.000Z (over 6 years ago)
- Last Synced: 2025-01-09T05:17:35.584Z (about 1 year ago)
- Topics: api, microservice, mysql
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Plista
- [Mysql](#mysql)
- [API](#api)
- [Application](#application)
# Mysql

**showing all campaigns of advertiser #100 that have more than 50 ads**
```sql
SELECT count(ads.id) as count, campaigns.*
FROM ads
INNER JOIN campaigns on ads.campaign_id = campaigns.id
WHERE campaigns.advertiser_id = 100
GROUP BY campaign_id
HAVING count > 50
ORDER BY count DESC
```
**showing all campaigns that do not have any ads**
```sql
SELECT campaigns.*
FROM campaigns
LEFT JOIN ads on campaigns.id = ads.campaign_id
WHERE ads.id IS NULL
```
# Api
## Schema & Current Version
All API access is over HTTPS, and accessed from `https://api.plista.com`. All data is sent and received as JSON.
By default, all requests to `https://api.plista.com` receive the `v1` version of the REST API. We encourage you to explicitly request this version via the Accept header.
```
Accept: application/vnd.plista.v1+json
```
## Ads
### Selecting a specific ad
```
GET /ads/:id
```
**Response**
```
Status: 200 OK
{
"id": int,
"campaignId": int,
"title": "string",
"text": "string",
"image": "string",
"sponsoredBy": "string",
"trackingUrl" : "string"
}
```
```
Status 404 Not Found
{
"message": "Not found"
}
```
### Creating an ad
```
POST /ads
```
**Parameters**
```
{
"campaignId": int,
"title": "string",
"text": "string",
"image": "string",
"sponsoredBy": "string",
"trackingUrl" : "string"
}
```
**Response**
```
Status 201 Created
{
"message": "Created"
"id": int
}
```
```
Status 422 Unprocessable entity
{
"message": "Unprocessable entity",
"errors": [
]
}
```
### Modifying a specific ad
```
PUT /ads/:id
```
**Parameters**
```
{
"campaignId": int,
"title": "string",
"text": "string",
"image": "string",
"sponsoredBy": "string",
"trackingUrl" : "string"
}
```
**Response**
```
Status 204 Updated
{
"message": "Updated"
"id": int
}
```
```
Status 422 Unprocessable entity
{
"message": "Unprocessable entity",
"errors": [
]
}
```
## Campaigns
### Selecting all ads of a specific campaign
```
GET /campaigns/:id/ads
```
**Response**
```
Status: 200 OK
{
"ads": [
{
"id": int,
"campaignId": int,
"title": "string",
"text": "string",
"image": "string",
"sponsoredBy": "string",
"trackingUrl" : "string"
}
]
}
```
```
Status 404 Not Found
{
"message": "Not found"
}
```
## Advertisers
### selecting all ads of a specific advertiser
```
GET /advertisers/:id/ads
```
**Response**
```
Status: 200 OK
{
"ads": [
{
"id": int,
"campaignId": int,
"title": "string",
"text": "string",
"image": "string",
"sponsoredBy": "string",
"trackingUrl" : "string"
}
]
}
```
```
Status 404 Not Found
{
"message": "Not found"
}
```
# Application
- [Backend](https://github.com/OmarMakled/device-detector-server)
- [Frontend](https://github.com/OmarMakled/device-detector-client)