GithubHelp home page GithubHelp logo

backend's Introduction

Pintereach API

https://pintereach1.herokuapp.com

Endpoints

Method Endpoint Description
POST /api/register Create user and return token
POST /api/login Authenticate user and return token
GET /api/validate Verify token
GET /api/articles Retrieve saved articles
GET /api/articles/:id Retrieve article by id
POST /api/articles/ Save article
PUT /api/articles/:id Edit saved article
DELETE /api/articles/:id Remove saved article
GET /api/categories Retrieve categories
POST /api/categories Add category
GET /api/categories/:id/articles Retrieve articles within a category
POST /api/categories/:id/articles Assign article to a category
DELETE /api/categories/:id/articles Remove article from a category
GET /api/boards/:id Retrieve board by id
POST /api/boards Add board

All routes

  • users only have access to their own resources
  • token in Authorization request header (required) - except /api/register, /api/login, and /api/validate

Questions

How do I post an article to a board?

Use the PUT /api/articles/:id endpoint to change an article's board_id property, which refers to the id of a given board. An article can only be posted to one board, but it may be assigned to more than one category.

POST /api/register

https://pintereach1.herokuapp.com/api/register

Create user and return token

  • username (required) - must be unique
  • password (required)
  • email (required) - must be unique

Body

{
    "username": "moo",
    "password": "cat",
    "email": "[email protected]"
}

POST /api/login

https://pintereach1.herokuapp.com/api/login

Authenticate user and return token

  • username (required)
  • password (required)

Body

{
    "username": "moo",
    "password": "cat"
}

GET /api/validate

https://pintereach1.herokuapp.com/api/validate

Verify token

Example Response

{
    "validToken": true,
    "message": "Valid token."
}

GET /api/articles

https://pintereach1.herokuapp.com/api/articles

Retrieve saved articles

Example Response

GET /api/articles/:id

https://pintereach1.herokuapp.com/api/articles/:id

Retrieve article by id

Example Response

{
    "id": 2,
    "url": "https://www.javascriptstuff.com/component-communication",
    "title": "8 no-Flux strategies for React component communication",
    "image": "https://www.javascriptstuff.com/static/parent-to-child-fc4c68730b003da3f9d20dd57cf52d20-8aa1a.png",
    "description": "Sending data between React components can seem like a pain at first. Here are some simple strategies.",
    "notes": null,
    "board_id": 1,
    "user_id": 1
}

POST /api/articles/:id

https://pintereach1.herokuapp.com/api/articles/:id

Save article

  • url (required)
  • title, image (image url), description - if unspecified in request body, Pintereach will attempt to populate these fields with values from LinkPreview API
  • notes
  • board_id
  • Returns saved articles

Example Response

PUT /api/articles/:id

https://pintereach1.herokuapp.com/api/articles/:id

Edit saved article

  • Returns updated article

Body

{
    "notes": "I better take notes on this!"
}

DELETE /api/articles

https://pintereach1.herokuapp.com/api/articles/:id

Remove saved article

  • Returns saved articles

GET /api/categories

https://pintereach1.herokuapp.com/api/categories

Retrieve categories

Example Response

POST /api/categories

https://pintereach1.herokuapp.com/api/categories

Add category

  • name (required)
  • Returns created category

Body

{
    "name": "JavaScript"
}

GET /api/categories/:id/articles

https://pintereach1.herokuapp.com/api/categories/:id/articles

Retrieve articles within a category

  • category id in route parameters (required)

Example Response

POST /api/categories/:id/articles

https://pintereach1.herokuapp.com/api/categories/:id/articles

Assign article to a category

  • category id in route parameters (required)
  • Returns articles within the given category

Body

{
   "article_id": "1"
}

DELETE /api/categories/:id/articles

https://pintereach1.herokuapp.com/api/categories/:id/articles/{?artid}

Remove article from a category

  • category id in route parameters (required)
  • article id as artid in query parameters (required)
  • Returns articles within the given category

Example Query String

https://pintereach1.herokuapp.com/api/categories/1/articles?artid=1

GET /api/boards/:id

https://pintereach1.herokuapp.com/api/boards/:id

Retrieve board by id

Example Response

POST /api/boards

https://pintereach1.herokuapp.com/api/boards

Add board

  • name (required)
  • description
  • private (boolean, default to false) - for features in a future release: ability to view other users' boards, make boards private
  • Returns created board

Example Response

{
    "id": 1,
    "name": "Full Stack Web",
    "description": "Learning front end and back end.",
    "private": false,
    "user_id": 1
}

backend's People

Contributors

jskway avatar ljh-c avatar

Watchers

 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.