Stress Induced Nightmare Fuel ad/content server and editor for IFixit
DRY Points
-
All URLs are expected to be prefixed with https://domain.ext/api
-
All responses are in JSON form
-
Any data in path like: /{} is a request parameter, all else is in the body
-
All response codes are in line with the Mozilla standard
Ad Data Object
-
adId
- Stored in ad inventory with primary key as unique ad id/name
-
adName (63 char max)
- User given name of the ad
-
imageLoc
- The path where the image is located
-
mainText (63 char max)
- User given main ad text
-
subText (255 char max)
- User given secondary text
-
linkText
- The text displayed that will act as a link
-
linkLoc (255 char max)
- The http link to where the ad should redirect to
-
Height
- Pixels
-
Width
- Pixels
-
flightId
- Flight id. String identifier of one of the available flights
Ad Stats Object
-
adId
- As in ad data object
-
adName
- As in ad data object
flightId
- As in ad data object
-
impressions
-
clicks
-
conversions
Decision API
/decide
- GET
- In body of request contain:
- zoneSize
- deviceType
- Returns an ad object with flight matching deviceType and size within zoneSize
- In body of request contain:
Inventory API
```
/inventory
```
-
POST
- In body of request contain:
- image (2mb max, binary data)
- Ad object as detailed above
- Stores the ad image data in inventory storage
- Sends POST to /report/{adId}
- Returns a JSON object denoting POST status, adId, and all given data
- In body of request contain:
-
GET
- Returns an array of all ad objects stored
/inventory/{adId}
-
GET
- Returns the ad object with given adID
-
PUT
- Body contains a partially or entirely full ad object
- Given values will update existing values for ad with given adId
-
DELETE
- Deletes ad with adId
/inventory/flights
-
GET
- Returns an array of all available flights
/inventory/flights/{flightId}
-
GET
- Returns an array of all ads in flight flights
Reporting API
```
/reports/{adId}
```
-
PUT
- Takes in partially or entirely full ad stats object
- Updates previous stats with given stats for a specific ad.
-
POST
- Creates the first entry for a new ad with 0 for all stats
- Dev note: call this when putting a new ad in the inventory
-
GET
- Returns an ad stats object with given adId
/reports/{flightId}
-
GET
- Returns array of ad stats objects which all have given flightId