Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

API Documentation

Steven Oud edited this page Feb 28, 2020 · 6 revisions

Table of Contents

API endpoint: https://api.schroeff.com/

Get all discounts

GET /sites

Response
Status: 200 OK
Content-Type: application/json
[
  {
    "id": 1,
    "site_name": "Spotify",
    "product_name": "Spotify Premium",
    "url": "https://www.spotify.com/nl/student/",
    "thumbnail": "https://www.scdn.co/i/_global/open-graph-default.png",
    "description": "50% studenten korting op Spotify Premium",
    "discount_requirements": null,
    "upvotes": 11,
    "downvotes": 1,
    "createdAt": "2020-02-25T11:34:08.000Z",
    "updatedAt": "2020-02-25T11:35:34.000Z"
  },
  {
    "id": 2,
    "site_name": "Adobe",
    "product_name": "Adobe Creative Cloud",
    "url": "https://www.adobe.com/nl/creativecloud/buy/students.html",
    "thumbnail": "https://www.adobe.com/thumb.800.480.png",
    "description": "65% korting op Adobe Creative Cloud",
    "discount_requirements": null,
    "upvotes": 1,
    "downvotes": 21,
    "createdAt": "2020-02-25T11:34:08.000Z",
    "updatedAt": "2020-02-25T11:34:08.000Z"
  }
]

Search for discount

GET /sites/search?query=:query

Parameters
Name Type Description
query string Search query
Response
Status: 200 OK
Content-Type: application/json
[
  {
    "id": 1,
    "site_name": "Spotify",
    "product_name": "Spotify Premium",
    "url": "https://www.spotify.com/nl/student/",
    "thumbnail": "https://www.scdn.co/i/_global/open-graph-default.png",
    "description": "50% studenten korting op Spotify Premium",
    "discount_requirements": null,
    "upvotes": 11,
    "downvotes": 1,
    "createdAt": "2020-02-25T11:34:08.000Z",
    "updatedAt": "2020-02-25T11:35:34.000Z"
  },
  {
    "id": 3,
    "site_name": "Microsoft",
    "product_name": "Office 365",
    "url": "https://www.microsoft.com/nl-nl/education/products/office",
    "thumbnail": null,
    "description": "Office 365 gratis",
    "discount_requirements": "Studenten e-mail",
    "upvotes": null,
    "downvotes": null,
    "createdAt": "2020-02-25T11:34:08.000Z",
    "updatedAt": "2020-02-25T11:34:08.000Z"
  }
]

Create discount entry

POST /sites

Parameters
Name Type Description
site_name string Name of the brand or site
product_name string Name of the discounted product (optional)
url string Link to the student discount page
description string Description of discount
discount_requirements string Requirements for getting discount (optional)
Response
Status: 201 Created
Content-Type: application/json
{
  "id": 12,
  "site_name": "Google",
  "url": "https://google.com",
  "thumbnail": null,
  "description": "20% faster search as student.",
  "discount_requirements": "Need a school e-mail.",
  "updatedAt": "2020-02-25T12:35:28.771Z",
  "createdAt": "2020-02-25T12:35:28.771Z"
}

Upvote/downvote discount

PUT /sites/:id/upvote|downvote

Parameters
Name Type Description
id int Discount ID
Response
Status: 200 OK
Content-Type: application/json

Revert upvote/downvote discount

PUT /sites/:id/upvote|downvote/revert

Parameters
Name Type Description
id int Discount ID
Response
Status: 200 OK
Content-Type: application/json