adverse
Native ad serving platform.
Last updated 2 years ago by kaiser_bakunawa .
MIT · Original npm · Tarball · package.json
$ cnpm install adverse 
SYNC missed versions from official npm registry.

Adverse

Native ad serving platform.

Running

This project has both the back-end API and front-end. npm run dev will start both for you.

In production, the front-end should be served from a CDN. The back-end API will run on our cluster.

npm install

# development:
npm run dev

# production
NODE_ENV=production npm start

API

POST /api/networks

Creates a Network

Accepts a JSON object:

{
  "name": "Adverse"
}

Response:

{
  "success": true,
  "message": "Network created.",
  "data": {
      "id": "7otihf",
      "name": "Adverse",
      "owner": "somebody@tt.com",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-04T23:21:25.041Z"
  }
}

PUT /api/networks/:id

Updates a Network

Accepts a JSON object:

{
  "id": "7otihf",
  "name": "Interlincx2"
}

Response:

{
  "success": true,
  "message": "Network updated.",
  "data": {
      "id": "7otihf",
      "name": "Interlincx2",
      "owner": "somebody@tt.com",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-05T01:00:00.000Z"
  }
}

GET /api/networks

List Networks

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "7otihf",
      "name": "Interlincx2",
      "owner": "somebody@tt.com",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-05T01:00:00.000Z"
    }
  ]
}

GET /api/networks/:id

Get Network

Response:

{
  "data": {
    "id": "7otihf",
    "name": "Interlincx2",
    "owner": "somebody@tt.com",
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-05T01:00:00.000Z"
  }
}

POST /api/advertisers

Creates an Advertiser

Accepts a JSON object:

{
  "name": "Interlincx"
}

Response:

{
  "success": true,
  "message": "Advertiser created.",
  "data": {
      "id": "7otihf",
      "name": "Interlincx",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-04T23:21:25.041Z"
  }
}

PUT /api/advertisers/:id

Updates an Advertiser

Accepts a JSON object:

{
  "id": "7otihf",
  "name": "Interlincx2"
}

Response:

{
  "success": true,
  "message": "Advertiser updated.",
  "data": {
      "id": "7otihf",
      "name": "Interlincx2",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-05T01:00:00.000Z"
  }
}

GET /api/advertisers?networkId=...

List Advertisers

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "7otihf",
      "name": "Interlincx2",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-05T01:00:00.000Z"
    }
  ]
}

GET /api/advertisers/:id

Get Advertiser

Response:

{
  "data": {
    "id": "7otihf",
    "name": "Interlincx2",
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-05T01:00:00.000Z"
  }
}

POST /api/campaigns

Creates a Campaign

Accepts a JSON object:

{
  "name": "My Campaign",
  "advertiserId": "7otihf"
}

Response:

{
  "success": true,
  "message": "Campaign created.",
  "data": {
      "id": "x582is",
      "name": "My Campaign",
      "advertiserId": "7otihf",
      "dateCreated": "2017-04-04T23:30:00.000Z",
      "dateUpdated": "2017-04-04T23:30:00.000Z"
  }
}

PUT /api/campaigns/:id

Updates a Campaign

Accepts a JSON object:

{
  "id": "x582is",
  "name": "My Edited Campaign",
  "advertiserId": "7otihf"
}

Response:

{
  "success": true,
  "message": "Campaign created.",
  "data": {
    "id": "x582is",
    "name": "My Edited Campaign",
    "advertiserId": "7otihf",
    "dateCreated": "2017-04-04T23:30:00.000Z",
    "dateUpdated": "2017-04-05T23:30:00.000Z"
  }
}

GET /api/campaigns

List Campaigns

Query Parameters:

  • advertiserId: limit results to single advertiser

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "x582is",
      "name": "My Edited Campaign",
      "advertiserId": "7otihf",
      "dateCreated": "2017-04-04T23:30:00.000Z",
      "dateUpdated": "2017-04-05T23:30:00.000Z"
    }
  ]
}

GET /api/campaigns/:id

Get Campaign

Response:

{
  "data": {
    "id": "x582is",
    "name": "My Edited Campaign",
    "advertiserId": "7otihf",
    "dateCreated": "2017-04-04T23:30:00.000Z",
    "dateUpdated": "2017-04-05T23:30:00.000Z"
  }
}

POST /api/ad-groups

Creates an Ad Group

Accepts a JSON object:

{
  "name": "My Ad Group",
  "advertiserId": "7otihf",
  "campaignId": "x582is"
}

Response:

{
  "success": true,
  "message": "Ad Group created.",
  "data": {
      "id": "6l5bi6",
      "name": "My Ad Group",
      "advertiserId": "7otihf",
      "campaignId": "x582is",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-05T23:30:00.000Z"
  }
}

PUT /api/ad-groups/:id

Updates an Ad Group

Accepts a JSON object:

{
  "id": "6l5bi6",
  "name": "My Updated Ad Group",
  "advertiserId": "7otihf",
  "campaignId": "x582is"
}

Response:

{
  "success": true,
  "message": "Ad Group updated.",
  "data": {
      "id": "6l5bi6",
      "name": "My Updated Ad Group",
      "advertiserId": "7otihf",
      "campaignId": "x582is",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-06T23:30:00.000Z"
  }
}

GET /api/ad-groups

List Ad Groups

Query Parameters:

  • advertiserId: limit results to single advertiser
  • campaignId: limit results to single campaign

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "6l5bi6",
      "name": "My Updated Ad Group",
      "advertiserId": "7otihf",
      "campaignId": "x582is",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-06T23:30:00.000Z"
    }
  ]
}

GET /api/ad-groups/:id

Get Ad Group

Response:

{
  "data": {
    "id": "6l5bi6",
    "name": "My Updated Ad Group",
    "advertiserId": "7otihf",
    "campaignId": "x582is",
    "dateCreated": "2017-04-05T23:30:00.000Z",
    "dateUpdated": "2017-04-06T23:30:00.000Z"
  }
}

POST /api/creatives

Creates creative

Accepts a JSON object:

{
  "advertiserId": "7otihf",
  "name": "Some Creative",
  "url": "https://adverse.lincx.la",
  "alt": "This is the alt text for the image",
  "src": "https://cdn.adverse.com/path/img.jpg"
}

Response:

{
  "success": true,
  "message": "Creative created.",
  "data": {
      "id": "ib7h56",
      "advertiserId": "7otihf",
      "name": "Some Creative",
      "url": "https://adverse.lincx.la",
      "alt": "This is the alt text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-05T23:30:00.000Z"
  }
}

PUT /api/creatives/:id

Updates a creative

Accepts a JSON object:

{
  "advertiserId": "7otihf",
  "name": "Some Creative Updated",
  "url": "https://adverse.lincx.la",
  "alt": "Changed Text for the image",
  "src": "https://cdn.adverse.com/path/img.jpg"
}

Response:

{
  "success": true,
  "message": "Creative updated.",
  "data": {
      "id": "ib7h56",
      "advertiserId": "7otihf",
      "name": "Some Creative Updated",
      "url": "https://adverse.lincx.la",
      "alt": "Changed Text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-10T23:30:00.000Z"
  }
}

GET /api/creatives

List Creatives

Query Parameters:

  • advertiserId: limit results to single advertiser

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "ib7h56",
      "advertiserId": "7otihf",
      "name": "Some Creative Updated",
      "url": "https://adverse.lincx.la",
      "alt": "Changed Text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-10T23:30:00.000Z"
    }
  ]
}

GET /api/creatives/:id

Get a Creative

Response:

{
  "data": {
    "id": "ib7h56",
    "advertiserId": "7otihf",
    "name": "Some Creative Updated",
    "url": "https://adverse.lincx.la",
    "alt": "Changed Text for the image",
    "src": "https://cdn.adverse.com/path/img.jpg",
    "dateCreated": "2017-04-05T23:30:00.000Z",
    "dateUpdated": "2017-04-10T23:30:00.000Z"
  }
}

POST /api/ads

Creates Ad

Accepts a JSON object:

{
  "campaignId": "7otihf",
  "adGroupId": "6l5bi6",
  "creativeId": "ib7h56"
}

Response:

{
  "success": true,
  "message": "Ad created.",
  "data": {
    "id": "9c2a7c",
    "campaignId": "7otihf",
    "adGroupId": "6l5bi6",
    "creative": {
      "id": "ib7h56",
      "advertiserId": "7otihf",
      "name": "Some Creative Updated",
      "url": "https://adverse.lincx.la",
      "alt": "Changed Text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-10T23:30:00.000Z"
    },
    "dateCreated": "2017-04-10T23:30:00.000Z",
    "dateUpdated": "2017-04-10T23:30:00.000Z"
  }
}

PUT /api/ads/:id

Updates an Ad

Accepts a JSON object:

{
  "id": "9c2a7c",
  "campaignId": "7otihf",
  "adGroupId": "6l5bi6",
  "creativeId": "ib7h46"
}

Response:

{
  "success": true,
  "message": "Ad updated.",
  "data": {
    "id": "9c2a7c",
    "campaignId": "7otihf",
    "adGroupId": "6l5bi6",
    "creative": {
      "id": "ib7h46",
      "advertiserId": "7otihf",
      "name": "Some Creative Modified",
      "url": "https://adverse.lincx.la",
      "alt": "Changes Text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-10T23:30:00.000Z"
    },
    "dateCreated": "2017-04-10T23:30:00.000Z",
    "dateUpdated": "2017-04-12T12:30:00.000Z"
  }
}

GET /api/ads/:id

Get an Ad

Response:

{
  "data": {
    "id": "9c2a7c",
    "campaignId": "7otihf",
    "adGroupId": "6l5bi6",
    "creative": {
      "id": "ib7h46",
      "advertiserId": "7otihf",
      "name": "Some Creative Modified",
      "url": "https://adverse.lincx.la",
      "alt": "Changes Text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-10T23:30:00.000Z"
    },
    "dateCreated": "2017-04-10T23:30:00.000Z",
    "dateUpdated": "2017-04-10T23:30:00.000Z"
  }
}

GET /api/ads

List Ads

Query Parameters:

  • adGroupId: limit results to single adGroup

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
    "id": "9c2a7c",
    "campaignId": "7otihf",
    "adGroupId": "6l5bi6",
    "creative": {
      "id": "ib7h46",
      "advertiserId": "7otihf",
      "name": "Some Creative Modified",
      "url": "https://adverse.lincx.la",
      "alt": "Changes Text for the image",
      "src": "https://cdn.adverse.com/path/img.jpg",
      "dateCreated": "2017-04-05T23:30:00.000Z",
      "dateUpdated": "2017-04-10T23:30:00.000Z"
    },
    "dateCreated": "2017-04-10T23:30:00.000Z",
    "dateUpdated": "2017-04-10T23:30:00.000Z"
  }
 ]
}

GET /api/ads/ad

List Ads

This endpoint returns an ad to the publisher.

Query Parameters:

Response

{
  "data":
    {
      "name": "creative-0",
      "url": "https://www.someh.la/0'",
      "alt": "Creative for - 0",
      "src": "http://image.s3.com/image.png",
      "id": "3lfzvn",
      "advertiserId": "6lfbgx"
    }
}

Publishers

POST /api/publishers

Creates a Publisher

Accepts a JSON object:

{
  "name": "SuperPublisher"
}

Response

{
  "success": true,
  "message": "Publisher created.",
  "data": {
    "id": "ih389f",
    "name": "SuperPublisher",
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-04T23:21:25.041Z"
  }
}

PUT /api/publishers/:id

Updates a Publisher

Accepts a JSON object:

{
  "id": "ih389f",
  "name": "SuperPublisher"
}

Response

{
  "success": true,
  "message": "Publisher updated.",
  "data": {
    "id": "ih389f",
    "name": "SuperPublisher",
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-05T13:21:25.020Z"
  }
}

GET /api/publishers

List Publishers

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "f17oze",
      "name": "Superpub",
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-05T01:00:00.000Z"
    }
  ]
}

GET /api/publishers/:id

Get Publisher

Response:

{
  "data": {
    "id": "f17oze",
    "name": "Superpub",
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-05T01:00:00.000Z"
  }
}

Channels

POST /api/channels

Accepts a JSON object

{
  "name": "Channel 1",
  "publisherId": "f17oze"
}

Response

{
  "success": true,
  "message": "Channel created.",
  "data": {
    "id": "ase89w",
    "name": "Channel 1",
    "dateCreated": "2017-05-01T18:21:25.041Z",
    "dateUpdated": "2017-05-01T18:21:25.041Z"
  }
}

PUT /api/channels/:id

Accepts a JSON object

{
  "id": "ase89w",
  "name": "Channel 1",
  "publisherId": "f17oze"
}

Response

{
  "success": true,
  "message": "Channel updated.",
  "data": {
    "id": "ase89w",
    "name": "Channel 1",
    "dateCreated": "2017-05-01T18:21:25.041Z",
    "dateUpdated": "2017-06-01T15:29:35.061Z"
  }
}

GET /api/channels

List Channels

Response:

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "ase89w",
      "name": "Channel 1",
      "dateCreated": "2017-05-01T18:21:25.041Z",
      "dateUpdated": "2017-06-01T15:29:35.061Z"
    }
  ]
}

GET /api/channels/:id

Get Channel

Response:

{
  "data": {
    "id": "ase89w",
    "name": "Channel 1",
    "dateCreated": "2017-05-01T18:21:25.041Z",
    "dateUpdated": "2017-06-01T15:29:35.061Z"
  }
}

Sites

POST /api/sites

Accepts a JSON object

{
  "name": "Best Food Ever",
  "url": "https://bestfoodever.com",
  "publisherId": "f17oze",
  "channelId": "ks2jym"
}

Response

{
  "success": true,
  "message": "Site created.",
  "data": {
    "id": "ty6bh7",
    "name": "Best Food Ever",
    "url": "https://bestfoodever.com",
    "publisherId": "f17oze",
    "channelId": "ks2jym",
    "dateCreated": "2017-05-01T18:21:25.041Z",
    "dateUpdated": "2017-05-01T18:21:25.041Z"
  }
}

PUT /api/sites/:id

Accepts a JSON object

{
  "id": "ty6bh7",
  "name": "Best Food Ever",
  "url": "https://www.bestfoodever.com",
  "publisherId": "f17oze",
  "channelId": "ks2jym"
}

Response

{
  "success": true,
  "message": "Site updated.",
  "data": {
    "id": "ty6bh7",
    "name": "Best Food Ever ",
    "url": "https://www.bestfoodever.com",
    "publisherId": "f17oze",
    "channelId": "ks2jym",
    "dateCreated": "2017-05-01T18:21:25.041Z",
    "dateUpdated": "2017-06-01T15:29:35.061Z"
  }
}

GET /api/sites

List Sites

Response

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "ty6bh7",
      "name": "Best Food Ever ",
      "url": "https://www.bestfoodever.com",
      "publisherId": "f17oze",
      "channelId": "ks2jym",
      "dateCreated": "2017-05-01T18:21:25.041Z",
      "dateUpdated": "2017-06-01T15:29:35.061Z"
    }
  ]
}

GET /api/sites/:id

List Site

Response

{
  "data": {
    "id": "ty6bh7",
    "name": "Best Food Ever ",
    "url": "https://www.bestfoodever.com",
    "publisherId": "f17oze",
    "channelId": "ks2jym",
    "dateCreated": "2017-05-01T18:21:25.041Z",
    "dateUpdated": "2017-06-01T15:29:35.061Z"
  }
}

Zones

POST /api/zones

Creates a zone

Accepts a JSON object:

{
  "name": "Sidebar",
  "siteId": "chnsoy",
  "publisherId": "f17oze",
  "channelId": "ks2jym",
  "adTypeId": "ab4r7t"
}

Response

{
  "success": true,
  "message": "Zone created.",
  "data": {
    "id": "nbcmjy",
    "name": "Sidebar",
    "siteId": "chnsoy",
    "publisherId": "f17oze",
    "channelId": "ks2jym",
    "adtype": {
      "id": "ab4r7t",
      "name": "Native Sponsored Item",
      "width": 100,
      "height": 100,
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-04T23:21:25.041Z"
    },
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-04T23:21:25.041Z"
  }
}

PUT /api/zones/:id

Updates a zone

Accepts a JSON object:

{
  "id": "nbcmjy",
  "name": "Sidebar",
  "siteId": "chnsoy",
  "publisherId": "f17oze",
  "channelId": "ks2jym",
  "adTypeId": "ddr7at"
}

Response

{
  "success": true,
  "message": "Zone updated.",
  "data": {
    "id": "nbcmjy",
    "name": "Sidebar",
    "siteId": "chnsoy",
    "publisherId": "f17oze",
    "channelId": "ks2jym",
    "adtype": {
      "id": "ddr7at",
      "name": "Billboard",
      "width": 300,
      "height": 100,
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-04T23:21:25.041Z"
    },
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-06-01T15:29:35.061Z"
  }
}

GET /api/zones

List Zones

Response

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "nbcmjy",
      "name": "Sidebar",
      "siteId": "chnsoy",
      "publisherId": "f17oze",
      "channelId": "ks2jym",
      "adtype": {
        "id": "ddr7at",
        "name": "Billboard",
        "width": 300,
        "height": 100,
        "dateCreated": "2017-04-04T23:21:25.041Z",
        "dateUpdated": "2017-04-04T23:21:25.041Z"
      },
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-06-01T15:29:35.061Z"
    }
  ]
}

GET /api/zones/:id

Get Ad Type

Response:

{
  "data": {
    "id": "nbcmjy",
    "name": "Sidebar",
    "siteId": "chnsoy",
    "publisherId": "f17oze",
    "channelId": "ks2jym",
    "adtype": {
      "id": "ddr7at",
      "name": "Billboard",
      "width": 300,
      "height": 100,
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-04-04T23:21:25.041Z"
    },
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-06-01T15:29:35.061Z"
  }
}

Ad Types

POST /api/ad-types

Creates a ad type

Accepts a JSON object:

{
  "name": "Native Sponsored Item",
  "width": 100,
  "height": 100
}

Response

{
  "success": true,
  "message": "Ad Type created.",
  "data": {
    "id": "immdz2",
    "name": "Native Sponsored Item",
    "width": 100,
    "height": 100,
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-04-04T23:21:25.041Z"
  }
}

PUT /api/ad-types/:id

Updates an ad type

Accepts a JSON object:

{
  "id": "immdz2",
  "name": "Native Item",
  "width": 100,
  "height": 100
}

Response

{
  "success": true,
  "message": "Ad Type updated.",
  "data": {
    "id": "immdz2",
    "name": "Native Item",
    "width": 100,
    "height": 100,
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-05-04T17:17:17.044Z"
  }
}

GET /api/ad-types

List Ad Types

Response

{
  "page": 1,
  "pageSize": 10,
  "totalPages":1,
  "totalItems":1,
  "data": [
    {
      "id": "immdz2",
      "name": "Native Item",
      "width": 100,
      "height": 100,
      "dateCreated": "2017-04-04T23:21:25.041Z",
      "dateUpdated": "2017-05-04T17:17:17.044Z"
    }
  ]
}

GET /api/ad-types/:id

Get Ad Type

Response:

{
  "data": {
    "id": "immdz2",
    "name": "Native Item",
    "width": 100,
    "height": 100,
    "dateCreated": "2017-04-04T23:21:25.041Z",
    "dateUpdated": "2017-05-04T17:17:17.044Z"
  }
}

Current Tags

  • 1.1.2                                ...           latest (2 years ago)

1 Versions

  • 1.1.2                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (45)
Dev Dependencies (26)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |