https://pintereach1.herokuapp.com
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 |
- users only have access to their own resources
- token in Authorization request header (required) - except
/api/register
,/api/login
, and/api/validate
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.
https://pintereach1.herokuapp.com/api/register
- username (required) - must be unique
- password (required)
- email (required) - must be unique
Body
{
"username": "moo",
"password": "cat",
"email": "[email protected]"
}
https://pintereach1.herokuapp.com/api/login
- username (required)
- password (required)
Body
{
"username": "moo",
"password": "cat"
}
https://pintereach1.herokuapp.com/api/validate
Example Response
{
"validToken": true,
"message": "Valid token."
}
https://pintereach1.herokuapp.com/api/articles
Example Response
https://pintereach1.herokuapp.com/api/articles/: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
}
https://pintereach1.herokuapp.com/api/articles/:id
- 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
https://pintereach1.herokuapp.com/api/articles/:id
- Returns updated article
Body
{
"notes": "I better take notes on this!"
}
https://pintereach1.herokuapp.com/api/articles/:id
- Returns saved articles
https://pintereach1.herokuapp.com/api/categories
Example Response
https://pintereach1.herokuapp.com/api/categories
- name (required)
- Returns created category
Body
{
"name": "JavaScript"
}
https://pintereach1.herokuapp.com/api/categories/:id/articles
- category id in route parameters (required)
Example Response
https://pintereach1.herokuapp.com/api/categories/:id/articles
- category id in route parameters (required)
- Returns articles within the given category
Body
{
"article_id": "1"
}
https://pintereach1.herokuapp.com/api/categories/:id/articles/{?artid}
- 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
https://pintereach1.herokuapp.com/api/boards/:id
Example Response
https://pintereach1.herokuapp.com/api/boards
- name (required)
- description
- private (
boolean
, default tofalse
) - 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
}