Code Monkey home page Code Monkey logo

redthat's Introduction

The Redthat API

The API provides the following endpoints:

Get a Single Submission

GET /submissions/1/

Response

200 OK

{
  'url': 'https://api.redthat.com/submissions/1/',
  'title': 'List of HTTP Status Codes',
  'external_link': 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes',
  'upvotes': 0,
  'downvotes': 0
}

List All Submissions

GET /submissions/

A paginated list of all submissions in the database

Response

200 OK

{
  'count': 1,
  'next': null, # the URL for the next page of results
  'previous': null, # the URL for the previous page of results
  'results': [
    {
      'url': 'https://api.redthat.com/sumbmissions/1/',
      'title': 'List of HTTP Status Code',
      'external_link': 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes',
      'upvotes': 0,
      'downvotes': 0
    },
    ...
  ]
}

Create a New Submission

POST /submissions/
Authorization: Token <token>

{
  'external_link': 'http://www.django-rest-framework.org/api-guide/serializers'
}

Response

201 Created

{
  'url': 'https://api.redthat.com/submissions/2/',
  'title': 'Serializers - Django REST Framework',
  'external_link': 'http://www.django-rest-framework.org/api-guide/serializers',
  'upvotes': 0,
  'downvotes': 0
}

Get a Token

POST /get-token/

{
  'email': '[email protected]'
}

Response

201 Created (or 200 OK if it already existed)

{
  'token': 'abc123',
}

Upvote an Existing Submission

POST /submission/1/upvote/
Authorization: Token <token>

Response

201 Created

{
  'url': 'https://api.redthat.com/submissions/1/',
  'title': 'List of HTTP Status Codes from Wikipedia', # updated
  'external_link': 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes',
  'upvotes': 1, # incremented
  'downvotes': 0
}

Downvote an Existing Submission

POST /submission/1/downvote/
Authorization: Token <token>

Response

201 Created

{
  'url': 'https://api.redthat.com/submissions/1/',
  'title': 'List of HTTP Status Codes from Wikipedia', # updated
  'external_link': 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes',
  'upvotes': 0,
  'downvotes': 1 # incremented
}

redthat's People

Contributors

kevinharvey avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.