By: Matthew Malone & Edwin Del Bosque
- Schema
- End Points
- GET Endpoints
- POST Endpoints
- DELETE Endpoints
- PATCH Endpoints
- API's used
- Project Management Board
One to Many
One User has many catalogs sigthings.
One Catalog has many Palettes.
User Info Object Example
{
id: 1,
firstName: 'Edwin',
lastName: 'Del Bosque',
email: '[email protected]',
password: <string>
}
Catalog's Info Object Examples
[{
id: 1,
catalogName: 'Personal',
user_id: 1
},
{
id: 2,
catalogName: 'Favorites',
user_id: 1
}]
Palette's Info Object Examples
[ {
id: 1,
paletteName: 'Winter',
colors:[...],
catalog_id: 1
},
{
id: 2,
paletteName: 'Fall',
colors:[...],
catalog_id: 2
}]
GET
endpoints
GET path:/api/v1/users/:userdId/catalogs
- Sample Response (ok) status: 200
- Will return an array of all catalogs specific to a user, each as an object.
- Each beach object will contain the following:
[{
id: 1,
catalogName: 'Personal',
user_id: 1
}]
Sample Response (error) status: 404
{ error: "Cannot retrieve Catalogs" }
GET path:/api/v1/users/:userdId/catalogs/:catalogId
- Sample Response (ok) status: 200
- Will return an object of a specific catalog for a user.
- Each beach object will contain the following:
{
id: 1,
catalogName: 'Personal',
user_id: 1
}
Sample Response (error) status: 404
{ error: "Cannot retrieve Catalog" }
GET path:/api/v1/users/:userdId/catalogs/:catalogId/palettes
- Sample Response (ok) status: 200
- Will return an array of all sightings from all beaches
- Each sighting object will contain the following:
[ {
id: 1,
paletteName: 'Winter',
colors:[...],
catalog_id: 1
},
{
id: 2,
paletteName: 'Fall',
colors:[...],
catalog_id: 2
}]
- Sample Response (error) status: 404
{
error: "Cannot retreive Palettes"
}
GET path:/api/v1/users/:userdId/catalogs/:catalogId/palettes/:paletteId
- Sample Response (ok) status: 200
- Will return an object of a palette from a specific Catalog
- Each Palette object will contain the following:
{
id: 2,
paletteName: 'Fall',
colors:[...],
catalog_id: 2
}
- Sample Response (error) status: 404
{
error: "Cannot retreive Palette"
}
POST
endpoints
POST path:/api/v1/users
This Post requires First and Last name, email and password. Logic is built in to verify valid email address and password must be at least 6 haracters long.
Format of POST body:
{
firstName: 'Sandler',
lastName: 'McCalsin',
email: '[email protected]',
password: '123456'
}
- Sample Response (ok) status: 201
{ firstName: 'Sandler', id: 98003}
- Sample Response (error) status: 422 - When all the parameters are not provided:
{
error: `Expected format: {
"firstName": <String>,
"lastName": <String>,
"email": <String>,
"password": <String>,
}. You're missing a "${requiredParameter}" property.`
}
- Sample Response (error) status: 422 - when email already exists
{ error: 'The request could not be completed due to email already in use' }
POST path:/api/v1/login
This Post requires email and password. Logic is built in to verify valid email address and password must be at least 6 haracters long.
Format of POST body:
{
email: '[email protected]',
password: '123456'
}
- Sample Response (ok) status: 201
{ firstName: 'Sandler', id: 98003}
- Sample Response (error) status: 422 - When all the parameters are not provided:
{
error: `Expected format: {
"firstName": <String>,
"lastName": <String>,
"email": <String>,
"password": <String>,
}. You're missing a "${requiredParameter}" property.`
}
- Sample Response (error) status: 404 - When email is not in system
{ error: 'Email not found' }
- Sample Response (error) status: 404 - When email is in system and but incorrect password
{ error: Incorrect Password' }
DELETE
endpoints
DELETE path:'/api/v1/users/:userId/catalogs/:catalogId/palettes/:paletteId'
- This only requires the id of the Palette you want to delete
- Sample Response (ok) status: 201 with message
`Palette <catalogId> was successfully removed`
DELETE path:'/api/v1/users/:userId/catalogs/:catalogId'
- This only requires the id of the Catalog you want to delete
- Sample Response (ok) status: 201 with message
`Catalog <catalogId> was successfully removed`
PATCH
endpoints
DELETE path:'/api/v1/users/:userId/catalogs/:catalogId/palettes/:paletteId'
- This requires the id of the Palette you want to patch
- Body needs to hold the part of the Palette to update
- Sample Response (ok) status: 20 with new name
{newName: <name of palette>}
DELETE path:'/api/v1/users/:userId/catalogs/:catalogId'
- This only requires the id of the Catalog you want to patch
- Body needs to hold the part of the Catalog to update
- Sample Response (ok) status: 201 with message
{newName: <name of catalog>}