Freedoor Prototype API documentation version v1
http://localhost:3000/freedor/v1
About Freedoor
Freedoor Prototype API description. CMPE 275 Project 2
/users
Create a new user
post /users
Create a new user
Body
Type: application/json
Example:
{
'firstName': 'Test',
'lastName': 'User',
'emaiId': 'Test.User@test.com',
'mobile': 4084084084
}
HTTP status code 200
Body
Type: application/json
Example:
{
'userId': '22f3bc90-7cf8-11e4-b4a9-0800200c9a66'
'firstName': 'Test',
'lastName': 'User',
'emaiId': 'Test.User@test.com',
'mobile': 4084084084
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Get the details of a user
get /users/{userId}
Get the details of a user
URI Parameters
- userId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'userId': '22f3bc90-7cf8-11e4-b4a9-0800200c9a66'
'firstName': 'Test',
'lastName': 'User',
'emaiId': 'Test.User@test.com',
'mobile': 4084084084
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
/category
Get the list of all categories in the system
Create a new category
get /category
Get the list of all categories in the system
HTTP status code 200
Body
Type: application/json
Example:
{
'categories' : [
{
'categoryId': '178e9610-7d00-11e4-b4a9-0800200c9a66',
'categoryName': 'Electronics'
},
{
'categoryId': '27e26d20-7d00-11e4-b4a9-0800200c9a66',
'categoryName': 'Home'
},
]
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
post /category
Create a new category
Body
Type: application/json
Example:
{
'categoryName': 'Automobiles'
}
HTTP status code 200
Body
Type: application/json
Example:
{
'categoryId': '733f2e70-7d00-11e4-b4a9-0800200c9a66',
'categoryName': 'Automobiles'
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Get a particular category by category id
get /category/{categoryId}
Get a particular category by category id
URI Parameters
- categoryId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'categoryId': '733f2e70-7d00-11e4-b4a9-0800200c9a66',
'categoryName': 'Automobiles'
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Get list of all products by category id
Create a new product in a particular category
get /category/{categoryId}/product
Get list of all products by category id
URI Parameters
- categoryId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'products': [
{
'productId': '1d6eba40-7d02-11e4-b4a9-0800200c9a66',
'productName': 'NewProduct',
'quantity': 5,
'userId': '37e55320-7d02-11e4-b4a9-0800200c9a66',
'expectedOffer': 'This is expected',
'productDesc': 'Its a test prodcut',
'productExpiryDate': 1407533802,
'isValid': 1,
'categoryId': '5b7442b0-7d02-11e4-b4a9-0800200c9a66',
'lastUpdated': 1407533802
}
]
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
post /category/{categoryId}/product
Create a new product in a particular category
URI Parameters
- categoryId: required (string)
Body
Type: application/json
Example:
{
'productName': 'NewProduct',
'quantity': 5,
'userId': '37e55320-7d02-11e4-b4a9-0800200c9a66',
'expectedOffer': 'This is expected',
'productDesc': 'Its a test prodcut',
'productExpiryDate': 1407533802,
'isValid': 1,
'categoryId': '5b7442b0-7d02-11e4-b4a9-0800200c9a66',
'lastUpdated': 1407533802
}
HTTP status code 200
Body
Type: application/json
Example:
{
'productId': '1d6eba40-7d02-11e4-b4a9-0800200c9a66',
'productName': 'NewProduct',
'quantity': 5,
'userId': '37e55320-7d02-11e4-b4a9-0800200c9a66',
'expectedOffer': 'This is expected',
'productDesc': 'Its a test prodcut',
'productExpiryDate': 1407533802,
'isValid': 1,
'categoryId': '5b7442b0-7d02-11e4-b4a9-0800200c9a66',
'lastUpdated': 1407533802
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Get details of a product by product id
Change the details of a product
Delete a product
get /category/{categoryId}/product/{productId}
Get details of a product by product id
URI Parameters
- categoryId: required (string)
- productId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'productId': '1d6eba40-7d02-11e4-b4a9-0800200c9a66',
'productName': 'NewProduct',
'quantity': 5,
'userId': '37e55320-7d02-11e4-b4a9-0800200c9a66',
'expectedOffer': 'This is expected',
'productDesc': 'Its a test prodcut',
'productExpiryDate': 1407533802,
'isValid': 1,
'categoryId': '5b7442b0-7d02-11e4-b4a9-0800200c9a66',
'lastUpdated': 1407533802
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
put /category/{categoryId}/product/{productId}
Change the details of a product
URI Parameters
- categoryId: required (string)
- productId: required (string)
Body
Type: application/json
Example:
{
'productId': '1d6eba40-7d02-11e4-b4a9-0800200c9a66',
'productName': 'NewProduct',
'quantity': 5,
'userId': '37e55320-7d02-11e4-b4a9-0800200c9a66',
'expectedOffer': 'This is expected',
'productDesc': 'Its a test prodcut',
'productExpiryDate': 1407533802,
'isValid': 1,
'categoryId': '5b7442b0-7d02-11e4-b4a9-0800200c9a66',
'lastUpdated': 1407533802
}
HTTP status code 200
Body
Type: application/json
Example:
{
'productId': '1d6eba40-7d02-11e4-b4a9-0800200c9a66',
'productName': 'NewProduct',
'quantity': 5,
'userId': '37e55320-7d02-11e4-b4a9-0800200c9a66',
'expectedOffer': 'This is expected',
'productDesc': 'Its a test prodcut',
'productExpiryDate': 1407533802,
'isValid': 1,
'categoryId': '5b7442b0-7d02-11e4-b4a9-0800200c9a66',
'lastUpdated': 1407533802
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
delete /category/{categoryId}/product/{productId}
Delete a product
URI Parameters
- categoryId: required (string)
- productId: required (string)
HTTP status code 200
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Get list of all offers made on a particular product
Create a new offer
get /category/{categoryId}/product/{productId}/offer
Get list of all offers made on a particular product
URI Parameters
- categoryId: required (string)
- productId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'offers': [
{
'offerId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
},
{
'offerId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
}
]
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
post /category/{categoryId}/product/{productId}/offer
Create a new offer
URI Parameters
- categoryId: required (string)
- productId: required (string)
Body
Type: application/json
Example:
{
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
}
HTTP status code 200
Body
Type: application/json
Example:
{
'offerId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Get an offer based on offer id
Change details of a particular offer
Delete an offer
get /category/{categoryId}/product/{productId}/offer/{offerId}
URI Parameters
- categoryId: required (string)
- productId: required (string)
- offerId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'offerId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
put /category/{categoryId}/product/{productId}/offer/{offerId}
Change details of a particular offer
URI Parameters
- categoryId: required (string)
- productId: required (string)
- offerId: required (string)
Body
Type: application/json
Example:
{
'offerId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
}
HTTP status code 200
Body
Type: application/json
Example:
{
'offerId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyingQty': 2,
'offeredDetails': 'This can be offered',
'buyerStatus': 'Pending|Accepted|Rejected',
'sellerStatus': 'Pending|Accepted|Rejected',
'offerExpiry': 1407533802,
'productId': 'c59c6850-7d13-11e4-b4a9-0800200c9a66',
'buyerId': 'd60c6850-7d13-11e4-b4a9-0800200c9a67',
'lastModified': 1407533802
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
delete /category/{categoryId}/product/{productId}/offer/{offerId}
Delete an offer
URI Parameters
- categoryId: required (string)
- productId: required (string)
- offerId: required (string)
HTTP status code 200
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Get history of events for a given offer in reverse chronological order
get /category/{categoryId}/product/{productId}/offer/{offerId}/history
Get history of events for a given offer in reverse chronological order
URI Parameters
- categoryId: required (string)
- productId: required (string)
- offerId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
'history': [
{
'offerHistoryId': '4e280bb0-7d15-11e4-b4a9-0800200c9a66',
'modified': 'Buyer Quantity was modified from 5 to 10',
'lastModified': 1407533802,
'offerId': '5f391cc0-7d15-11e4-b4a9-0800200c9a66'
},
{
'offerHistoryId': '5g531bb0-7d15-11e4-b4a9-0800200c9a66',
'modified': 'Buyer Quantity was modified from 5 to 10',
'lastModified': 1407533702,
'offerId': '4sd52cc0-7d15-11e4-b4a9-0800200c9a66'
}
]
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}
Create a new comment on a given offer
post /category/{categoryId}/product/{productId}/offer/{offerId}/comment
Create a new comment on a given offer
URI Parameters
- categoryId: required (string)
- productId: required (string)
- offerId: required (string)
Body
Type: application/json
Example:
{
'comment': 'This was commented by a user, buyer or seller at time.',
'userId': 'e5a50560-7d15-11e4-b4a9-0800200c9a66'
}
HTTP status code 200
Body
Type: application/json
Example:
{
'commentId': 'c7f69a10-7d15-11e4-b4a9-0800200c9a66',
'comment': 'This was commented by a user, buyer or seller at time.',
'userId': 'e5a50560-7d15-11e4-b4a9-0800200c9a66'
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 404
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 404,
"errorMessage": "Not Found"
}
HTTP status code 500
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 500,
"errorMessage": "Internal Server Error"
}