Developer Documentation

Wedding Registry API Endpoint Guide

Useful information to help developers understand and use our backend API


Registry

Code References

Prefer reading code? Use these links to view the code

Routes

View all the registry routes below
GET -api/registry
Description:

Get all/every registry

Authentication:

Route is protected for: no one

Returns:

Success: An array of registry objects with their items array populated

Failed: { message: 'A detailed error message here' }

Body:
No body needed
GET -api/registry/admin
Description:

Get the registry of the current logged in user

Authentication:

Route is protected for: registry owner or admin

Returns:

Success: A registry object

Failed: { message: 'A detailed error message here' }

Body:
No body needed
POST -api/registry
Description:

Create a single registry

Authentication:

Route is protected for: paid users

Returns:

Success: An array of registry objects with their items array populated

Failed: { message: 'A detailed error message here' }

Body:
body = {
  title: String,
  description: String,
  p1FullName: String,
  p2FullName: String,
  email: String,
  customUrl: String, // no spaces
  items: [ String ],
  coverImage: String,
  userId: String,
  tyMessage: String, // optional
  weddingDate: Date.now(), // optional
  phoneNumber: Number, // optional
}
GET -api/registry/:customUrl
Description:

Get a single registry by it's customUrl

Authentication:

Route is protected for: no one

Returns:

Success: A registry object with its items array populated

Failed: { message: 'A detailed error message here' }

Body:
No body needed
PUT -api/registry/:registryId
Description:

Update a single registry

Authentication:

Route is protected for: registry owners or admins

Returns:

Success: An array of registry objects with their items array populated

Failed: { message: 'A detailed error message here' }

Body:
body = {
  title: String, // optional
  description: String, // optional
  p1FullName: String, // optional
  p2FullName: String, // optional
  email: String, // optional
  customUrl: String, // optional 
  coverImage: String, // optional
  tyMessage: String, // optional
  weddingDate: Date.now(), // optional
  phoneNumber: Number, // optional
}
DELETE -api/registry/:registryId
Description:

Delete a single registry and all it's items

Authentication:

Route is protected for: registry owners or admins

Returns:

Success: { message: 'Deleted registry and num/num items }

Failed: { message: 'A detailed error message here' }

Body:
No body needed

Items

Code References

Prefer reading code? Use these links to view the code

Routes

View all the items routes below
GET -api/item/all
Description:

Get all/every item

Authentication:

Route is protected for: no one

Returns:

Success: An array of item objects

Failed: { message: 'A detailed error message here' }

Body:
No body needed
GET -api/item/registry/:registryId
Description:

Get all item's for the Registry

Authentication:

Route is protected for: registry owners or admins

Returns:

Success: An array of item objects

Failed: { message: 'A detailed error message here' }

Body:
No body needed
GET -api/item/:itemId
Description:

Get a single item by it's id

Authentication:

Route is protected for: no one

Returns:

Success: An items object

Failed: { message: 'A detailed error message here' }

Body:
No body needed
POST -api/item/:itemId
Description:

Update item on purchase and save purchaser's info

Authentication:

Route is protected for: no one

Returns:

Success: An updated item object

Failed: { message: 'A detailed error message here' }

Body:
body = {
  name: String, // optional
  email: String, // optional
  message: String, // optional
  pricePaid: Number,
}
PUT -api/item/:itemId/registry/:registryId
Description:

Update one item's details

Authentication:

Route is protected for: registry owners or admins

Returns:

Success: An updated item object

Failed: { message: 'A detailed error message here' }

Body:
body = {
  name: String, // optional 
  description: String, // optional 
  price: Number, // optional
  link: String, // optional
  image: String, // optional 
  isReserved: String, // optional 
  reservedOn: Date.now(), // optional
}
DELETE -api/item/:itemId/registry/:registryId
Description:

Delete one item and remove it from that registry items array

Authentication:

Route is protected for: registry owners or admins

Returns:

Success: The deleted item object

Failed: { message: 'A detailed error message here' }

Body:
No body needed
POST -api/item/registry/:registryId
Description:

Create one item and add it to it's registry items array

Authentication:

Route is protected for: paid users

Returns:

Success: The new item object

Failed: { message: 'A detailed error message here' }

Body:
body = {
  name: String,
  description: String,
  price: Number,
  link: String, // optional
  image: String, // optional
}
DELETE -api/item/registry/:registryId
Description:

Delete multiple items and remove them from that registry items array

Authentication:

Route is protected for: registry owners or admins

Returns:

Success: { message: 'Updated registry items and deleted num/num items' }

Failed: { message: 'A detailed error message here' }

Body:
body = {
  arrayOfIds: [ String ]
}