Salesman API documentation version v1
http://salesman-betasjsu.rhcloud.com/api/v1
Salesman Backend API's
Salesman - Powering the In-Store Shopping Experience Prototype
/auth
Login to salesman and retrieve access tokens
post /auth
Login to salesman and retrieve access tokens
Body
Type: application/json
Example:
{
'email': 'Test.User@test.com',
'passsword': 'TestPassword123'
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1434607925152,
"created": 1434607502058,
"userId": "e397ff6d-6b26-4f4f-9ed1-92fc672e2397",
"accessToken": "e13388d4-9a39-4cd3-bda0-96221c43f0fb",
"name": {
"first": "neeraj",
"last": "sharma"
},
"email": "nitsnwits@gmail.com",
"verified": true
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Reset a user's password, sends e-mail to a user if the user is verified
post /auth/reset/password
Reset a user's password, sends e-mail to a user if the user is verified
Body
Type: application/json
Example:
{
"email": "nitsnwits@gmail.com"
}
HTTP status code 200
Body
Type: application/json
Example:
{
"url": "http://salesman-betasjsu.rhcloud.com/api/v1/reset/password/d7a6c474-61de-40e3-b1f3-3c232ea5621e"
}
{
"message": "Please verify your e-mail before resetting your password."
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Hit the link/url received in reset password api and system will send a new password to user
get /auth/reset/password/{key}
Hit the link/url received in reset password api and system will send a new password to user
URI Parameters
- key: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
message: "Your new password has been e-mailed to you."
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
/users
Create a new user or signup
post /users
Create a new user or signup
Body
Type: application/json
Example:
{
"name": {
"first": "test1",
"last": "sharma"
},
"password": "abcd",
"email": "test1@gmail.com"
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1434609990866,
"created": 1434607502058,
"userId": "e397ff6d-6b26-4f4f-9ed1-92fc672e2397",
"accessToken": "e13388d4-9a39-4cd3-bda0-96221c43f0fb",
"name": {
"first": "neeraj",
"last": "sharma"
},
"email": "nitsnwits@gmail.com",
"verified": true
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Get the details of a user
Change details of a user, A user can only change his name
Delete a user
get /users/{userId}
Get the details of a user
URI Parameters
- userId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1434609990866,
"created": 1434607502058,
"userId": "e397ff6d-6b26-4f4f-9ed1-92fc672e2397",
"accessToken": "e13388d4-9a39-4cd3-bda0-96221c43f0fb",
"name": {
"first": "neeraj",
"last": "sharma"
},
"email": "nitsnwits@gmail.com",
"verified": true
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
put /users/{userId}
Change details of a user, A user can only change his name
URI Parameters
- userId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"name": {
"first": "neerajUpdate"
}
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1434698488362,
"created": 1434643253341,
"userId": "25d1be1b-c34c-4393-b8b8-8f28c9d238fc",
"accessToken": "3366d96a-b137-47ae-a807-424fdac82fcf",
"name": {
"first": "neerajUpdate",
"last": "sharma"
},
"email": "nitsnwits@gmail.com",
"verified": true
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
delete /users/{userId}
Delete a user
URI Parameters
- userId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"code": "Are you sure you want to delete this user?"
}
HTTP status code 204
Successfully deleted resource(s)
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Verify a user's e-mail using the link received in the e-mail
get /users/{userId}/verify
Verify a user's e-mail using the link received in the e-mail
URI Parameters
- userId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
message: "Your e-mail has been verified."
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Change a user's password only
put /users/{userId}/password
Change a user's password only
URI Parameters
- userId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"password": "new"
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1434698612808,
"created": 1434643253341,
"userId": "25d1be1b-c34c-4393-b8b8-8f28c9d238fc",
"accessToken": "3366d96a-b137-47ae-a807-424fdac82fcf",
"name": {
"first": "neeraj",
"last": "sharma"
},
"email": "nitsnwits@gmail.com",
"verified": true
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Upload a photo for a user
post /users/{userId}/photo
Upload a photo for a user
URI Parameters
- userId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: image/png
Example:
binary data
HTTP status code 200
Body
Type: application/json
Example:
{
"accessToken": "21c38d35-fc34-47ee-85ab-85b642c75f35",
"created": 1435103947216,
"email": "test@gmail.com",
"name": {
"first": "neeraj",
"last": "sharma"
},
"photo": "http://s3.amazonaws.com/Salesman-Photos/0a7dbd89-4904-4a83-b6d5-897a9c44c89b",
"updated": 1435112835266,
"userId": "0a7dbd89-4904-4a83-b6d5-897a9c44c89b"
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Get shopping history of a user
get /users/{userId}/history
Get shopping history of a user
URI Parameters
- userId: required (string)
HTTP status code 200
Body
Type: application/json
Example:
[
{
'productId': '8ad5e23c-828f-40f5-8a60-7fdc36e02607',
'productName': 'Mens Shoes',
'categoryId': '8ad5e23c-828f-40f5-8a60-7fdc36e02607',
'brand': 'Puma',
'weight': '1/2 pounds',
'size': '9',
'listedPrice': 199,
'standardPrice': 399,
'color': 'blue',
'purchasedOn': 1434147513
}
]
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
/categories
Get all categories
Create a new category
get /categories
Get all categories
Headers
- Authorization: (string)
Use access token as value to Authorization header
HTTP status code 200
Body
Type: application/json
Example:
[
{
"updated": 1435822963187,
"created": 1435822963187,
"categoryId": "8cb577e8-bafd-4ea1-b38d-76cd351f61dc",
"name": "Autocare"
}
]
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
post /categories
Create a new category
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"name": "New Category",
"beaconName": "something",
"xCoord": 12.34,
"yCoord": 12.21
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1435822963187,
"created": 1435822963187,
"categoryId": "8cb577e8-bafd-4ea1-b38d-76cd351f61dc",
"name": "New Category",
"beaconName": "something",
"xCoord": 12.34,
"yCoord": 12.21
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Get one category by category id
Create a new category
Delete one category by category id
get /categories/{categoryId}
Get one category by category id
URI Parameters
- categoryId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1435822963187,
"created": 1435822963187,
"categoryId": "8cb577e8-bafd-4ea1-b38d-76cd351f61dc",
"name": "New Category",
"beaconName": "something",
"xCoord": 12.34,
"yCoord": 12.21
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
put /categories/{categoryId}
Create a new category
URI Parameters
- categoryId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"name": "New Category",
"beaconName": "something",
"xCoord": 12.34,
"yCoord": 12.21
}
HTTP status code 200
Body
Type: application/json
Example:
[
{
"updated": 1435822963187,
"created": 1435822963187,
"categoryId": "8cb577e8-bafd-4ea1-b38d-76cd351f61dc",
"name": "New Category",
"beaconName": "something",
"xCoord": 12.34,
"yCoord": 12.21
}
]
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
delete /categories/{categoryId}
Delete one category by category id
URI Parameters
- categoryId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
HTTP status code 204
Successfully deleted resource(s)
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
/products
Create a new product (categoryId is required field)
post /products
Create a new product (categoryId is required field)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"name": "iphone",
"categoryId": "5ca7ccf9-563f-4750-a074-98707b1c1e16"
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1435830180137,
"created": 1435830180137,
"productId": "5bcf1a79-0da5-4ead-9a00-1099a1746fc0",
"name": "iphone",
"categoryId": "5ca7ccf9-563f-4750-a074-98707b1c1e16"
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Search products based on a query
get /products/search
Search products based on a query
Headers
- Authorization: (string)
Use access token as value to Authorization header
Query Parameters
- query: (string)
Search string for the query (Do not put single quotes across query)
HTTP status code 200
Body
Type: application/json
Example:
[
{
"updated": 1435830180137,
"created": 1435830180137,
"productId": "5bcf1a79-0da5-4ead-9a00-1099a1746fc0",
"name": "iphone",
"categoryId": "5ca7ccf9-563f-4750-a074-98707b1c1e16"
}
]
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}
HTTP status code 503
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 503,
"errorMessage": "Service Unavailable"
}
Change details of a product
Delete a product based on product id
put /products/{productId}
Change details of a product
URI Parameters
- productId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
Body
Type: application/json
Example:
{
"name": "iphone",
"categoryId": "5ca7ccf9-563f-4750-a074-98707b1c1e16"
}
HTTP status code 200
Body
Type: application/json
Example:
{
"updated": 1435830180137,
"created": 1435830180137,
"productId": "5bcf1a79-0da5-4ead-9a00-1099a1746fc0",
"name": "iphone",
"categoryId": "5ca7ccf9-563f-4750-a074-98707b1c1e16"
}
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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 /products/{productId}
Delete a product based on product id
URI Parameters
- productId: required (string)
Headers
- Authorization: (string)
Use access token as value to Authorization header
HTTP status code 204
Successfully deleted resource(s)
HTTP status code 400
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 400,
"errorMessage": "Bad Request"
}
HTTP status code 401
Body
Type: application/json
Schema:
{
"status": "error",
"errorCode": 401,
"errorMessage": "Unauthorized"
}
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"
}