Skip to content
Nazar Lipkovs'kyy edited this page Feb 2, 2017 · 129 revisions

Documentation of SMSC

Documentation of JWT authentication

Receive new Access and Refresh tokens using valid credentials

URL /rest/auth/token
Method POST
URL Params None
Data Params Required: { "username" : [alphanumeric], "password" : [alphanumeric] }
Success Response Code: 200 OK
Content: { "token" : [string], "refreshToken" : [string] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Credentials are invalid. Please enter valid username and password" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{"username" : "User", "password" : "password"}' http://localhost:8080/rest/auth/token
### Receive refreshed Access token using valid Refresh token
URL /rest/auth/token
Method PUT
URL Params None
Data Params Required: { "expiredToken" : [string], "refreshToken" : [string] }
Success Response Code: 200 OK
Content: { "refreshedToken" : [string] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Refresh or expired access token is invalid. Please enter valid tokens" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{"expiredToken":"eyJhbG ciOiJIUzUxMiJ9.eyJzdWIiOiJBZG1pbiIsImNyZWF0ZWQiOjE0ODE2MzkxOTMxNjUsImV4cCI6M TQ4MTY0Mjc5M30.snx5TnaJ3baoKOwhDCBl8YKYCRCIvasDbSqsI8qHyrDkFjNu7lzIwlH9gUavx NfP3xmelZM6OC2HxomHaUvQ", "refreshToken":"eyJhbGciOiJIUzUxMiJ9.eyzdWIiOiJBZG 1pbiIsImNyZWF0ZWQiOjE0ODE2MzkxOTM0MjIsImV4cCI6MTQ4MTcyNTU5M30.2y6jkpg9hqFaHo DJ7eU4LCbRWjXENRPfGZtV0N3SKU1RBwSH5bujq2Fnq9jFOxvVbJETeGs7VGL9QqjpAnXkZ"}' http://localhost:8080/rest/auth/token
### Notes #### Default application properties, used for JWT authentication (can be changed through System properties): 1. jwt.header=X-Authorization 2. jwt.secret=smsc.io 3. jwt.expiration=3600 (Access token lives 1 hour, Refresh token - 1 day)

Documentation of REST API CRUD methods

User CRUD methods

Create user

URL /rest/repository/users
Method POST
URL Params None
Data Params Required: { "username" : [alphanumeric], "password" : [alphanumeric], "firstname" : [string], "surname" : [string], "email" : [email]}
Optional: "active" : [boolean], "blocked" : [boolean]
Success Response Code: 201 CREATED
Content: { "id": [long], "username" : [alphanumeric], "password" : [alphanumeric], "salt" : [alphanumeric], "firstname" : [string], "surname" : [string], "email" : [email], "active" : [boolean], created : [timestamp], "blocked" : [boolean] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 409 CONFLICT
Content: { "message": ""User with this username or email already exists" }
OR
Code: 400 BAD REQUEST
Content: { "errors" : [{"defaultMessage": "User username cannot be empty"}] }
OR
Code: 400 BAD REQUEST
Content: { "errors" : [{"defaultMessage": "User password cannot be empty"}] }
OR
Code: 400 BAD REQUEST
Content: { "errors" : [{"defaultMessage": "User firstname cannot be empty"}] }
OR
Code: 400 BAD REQUEST
Content: { "message" : " "errors" : [{"defaultMessage": "User surname cannot be empty"}] " }
OR
Code: 400 BAD REQUEST
Content: { "message" : " "errors" : [{"defaultMessage": "User email cannot be empty"}] " }
OR
Code: 400 BAD REQUEST
Content: { "message" : " "errors" : [{"defaultMessage": "User email has invalid format"}] " }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{ "username" : "Old Johnny", "password" : "john123456", "firstname" : "John", "surname" : "Forrester", "email" : "[email protected]", "active" : true, "blocked" : false }' http://localhost:8080/rest/repository/users
#### Update user
URL /rest/repository/users/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "username" : [alphanumeric], "password" : [alphanumeric], "salt" : [alphanumeric], "firstname" : [string], "surname" : [string], "email" : [email], "active" : [boolean], "blocked" : [boolean]
Success Response Code: 200 OK
Content: { "id": [long], "username" : [alphanumeric], "salt" : [alphanumeric], "firstname" : [string], "surname" : [string], "email" : [email], "active" : [boolean], created : [timestamp], "blocked" : [boolean] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 404 NOT FOUND
Content: { "message": "User with id = [long] was not found" }
OR
Code: 409 CONFLICT
Content: { "message": ""User with this username already exists" }
OR
Code: 409 CONFLICT
Content: { "message": ""User with this email already exists" }
OR
Code: 400 BAD REQUEST
Content: { "errors" : [{"defaultMessage": "User username cannot be empty"}] }
OR
Code: 400 BAD REQUEST
Content: { "errors" : [{"defaultMessage": "User password cannot be empty"}] }
OR
Code: 400 BAD REQUEST
Content: { "errors" : [{"defaultMessage": "User firstname cannot be empty"}] }
OR
Code: 400 BAD REQUEST
Content: { "message" : " "errors" : [{"defaultMessage": "User surname cannot be empty"}] " }
OR
Code: 400 BAD REQUEST
Content: { "message" : " "errors" : [{"defaultMessage": "User email cannot be empty"}] " }
OR
Code: 400 BAD REQUEST
Content: { "message" : " "errors" : [{"defaultMessage": "User email has invalid format"}] " }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{ "username" : "Old Johnny", "password" : "john123456", "firstname" : "John", "surname" : "Forrester", "email" : "[email protected]", "active" : true, "blocked" : false }' http://localhost:8080/rest/repository/users/1
#### Find one user
URL /rest/repository/users/:id
Method GET
URL Params Required:id=[integer]
Data Params None
Success Response Code: 200 OK
Content: { "id": [long], "username" : [alphanumeric], "salt": [alphanumeric], "firstname" : [string], "surname" : [string], "email" : [email], "active" : [boolean], "created": [timestamp], "blocked" : [boolean] }
Error Response Code: 404 NOT FOUND
Content: { "message": "User with id = [long] was not found" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/users/1
#### Find all users
URL /rest/repository/users
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: [{ "id": [long], "username" : [alphanumeric], "salt": [alphanumeric], "firstname" : [string], "surname" : [string], "email" : [email], "active" : [boolean], "created": [timestamp], "blocked" : [boolean] },...]
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/users
#### Delete user
URL /rest/repository/users/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
Content: { "message": "User with id = [long] was not found" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/users/1
### Role CRUD methods #### Create role
URL /rest/repository/roles
Method POST
URL Params None
Data Params Required: { "name" : [string] }
Success Response Code: 201 CREATED
Content: { "name" : [string] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (name)=[string] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Role name can be only uppercase and contain _ symbol" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Role name cannot be empty" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{"name" : "NEW_ROLE" }' http://localhost:8080/rest/repository/roles
#### Update role
URL /rest/repository/roles/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "name" : [string] }
Success Response Code: 200 OK
Content: { "name" : [string] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (name)=[string] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Role name can be only uppercase and contain _ symbol" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Role name cannot be empty" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{"name" : "NEW_ROLE" }' http://localhost:8080/rest/repository/roles/1
#### Find one role
URL /rest/repository/roles/:id
Method GET
URL Params Required:id=[integer]
Data Params None
Success Response Code: 200 OK
Content: { "name" : [string] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/roles/1
#### Find one role by name
URL /rest/repository/roles/search/findByName
Method GET
URL Params Required:name=[string]
Data Params None
Success Response Code: 200 OK
Content: { "name" : [string] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/roles/search/findByName?name=someName
#### Find all roles
URL /rest/repository/roles/search/findAll
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: { "_embedded": {"roles": [ { "name": [string] }, ... ] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/roles/search/findAll
#### Delete role
URL /rest/repository/roles/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/roles/1
### Customer CRUD methods #### Create customer
URL /rest/repository/customers
Method POST
URL Params None
Data Params Required: { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string] }
Optional: "vatid" : [double], "parentCustomer" : [URI]
Success Response Code: 201 CREATED
Content: { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string], "vatid" : [double] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (customer_id)=[double] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "customerId" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "companyName" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "street" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "street2" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "postcode" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "country" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "city" parameter cannot be empty" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{ "customerId" : 2.0, "companyName" : "newCompany", "street" : "newStreet", "street2" : "newStreet2", "postcode" : "79005", "country" : "Ukraine", "city" : "Lviv", "vatid" : 999.0 }' http://localhost:8080/rest/repository/customers
#### Update customer
URL /rest/repository/customers/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string]}
Optional: "vatid" : [double], "parentCustomer" : [URI]
Success Response Code: 200 OK
Content: { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string], "vatid" : [double] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (customer_id)=[double] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "customerId" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "companyName" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "street" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "street2" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "postcode" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "country" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer "city" parameter cannot be empty" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{ "customerId" : 2.0, "companyName" : "newCompany", "street" : "newStreet", "street2" : "newStreet2", "postcode" : "79005", "country" : "Ukraine", "city" : "Lviv", "vatid" : 999.0 }' http://localhost:8080/rest/repository/customers/1
#### Find one customer
URL /rest/repository/customers/:id
Method GET
URL Params Required:id=[integer]
Data Params None
Success Response Code: 200 OK
Content: { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string], "vatid" : [double] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/customers/1
#### Find one customer by customerId
URL /rest/repository/customers/search/findByCustomerId
Method GET
URL Params Required:customerId=[double]
Data Params None
Success Response Code: 200 OK
Content: { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string], "vatid" : [double] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/customers/search/findByCustomerId?customerId=10.0
#### Find all customers
URL /rest/repository/customers/search/findAll
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: { "_embedded": {"customers": [ { "customerId" : [double], "companyName" : [string], "street" : [string], "street2" : [string], "postcode" : [string], "country" : [string], "city" : [string], "vatid" : [double] }, ... ] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/customers/search/findAll
#### Delete customer
URL /rest/repository/customers/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
Content: { "message": "Customer with id = [long] was not found" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/customers/1
### CustomerContact CRUD methods #### Create customerContact
URL /rest/repository/customer-contacts
Method POST
URL Params None
Data Params Required: { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [email], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }
Optional: "customer" : [URI]
Success Response Code: 201 CREATED
Content: { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [email], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (email_address)=[string] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "firstname" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "surname" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "phone" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "mobilePhone" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "fax" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "emailAddress" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "emailAddress" has invalid format" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "type" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "salutation" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.customer.Salutation from String [string]: value not one of declared Enum instance names: [MR,MRS]" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.customer.Type from String [string]: value not one of declared Enum instance names: [PRIMARY, CEO, TECHNICAL]" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{ "firstname" : "newName", "surname" : "newSurname", "phone" : "0322222222", "mobilePhone" : "0632222222", "fax" : "new_fake_fax", "emailAddress" : "[email protected]", "type" : "CEO", "salutation" : "MR" }' http://localhost:8080/rest/repository/customer-contacts
#### Update customerContact
URL /rest/repository/customer-contacts/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [string], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }
Optional: "customer" : [URI]
Success Response Code: 200 OK
Content: { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [string], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (email_address)=[string] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "firstname" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "surname" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "phone" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "mobilePhone" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "fax" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "emailAddress" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "emailAddress" has invalid format" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "type" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Customer contact "salutation" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.customer.Salutation from String [string]: value not one of declared Enum instance names: [MR,MRS]" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.customer.Type from String [string]: value not one of declared Enum instance names: [PRIMARY, CEO, TECHNICAL]" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{ "firstname" : "newName", "surname" : "newSurname", "phone" : "0322222222", "mobilePhone" : "0632222222", "fax" : "new_fake_fax", "emailAddress" : "[email protected]", "type" : "CEO", "salutation" : "MR" }' http://localhost:8080/rest/repository/customer-contacts/1
#### Find one customerContact
URL /rest/repository/customer-contacts/:id
Method GET
URL Params Required:id=[integer]
Data Params None
Success Response Code: 200 OK
Content: { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [string], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/customer-contacts/1
#### Find one customerContact by email address
URL /rest/repository/customer-contacts/search/findByEmailAddress
Method GET
URL Params Required:emailAddress=[string]
Data Params None
Success Response Code: 200 OK
Content: { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [string], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/customer-contacts/search/[email protected]
#### Find all customerContacts
URL /rest/repository/customer-contacts/search/findAll
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: { "_embedded": {"customer-contacts": [ { "firstname" : [string], "surname" : [string], "phone" : [string], "mobilePhone" : [string], "fax" : [string], "emailAddress" : [string], "type" : [CEO,TECHNICAL,PRIMARY], "salutation" : [MR,MRS] }, ... ] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/customer-contacts/search/findAll
#### Delete customerContact
URL /rest/repository/customer-contacts/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/customer-contacts/1
### Dashboard CRUD methods #### Create dashboard
URL /rest/repository/dashboards
Method POST
URL Params None
Data Params Required: { "name" : [string], "icon" : [string], "user" : [URI] }
Success Response Code: 201 CREATED
Content: { "name" : [string], "icon" : [string], "user" : [URI] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (name)=[string] already exists." }
OR
Code: 409 CONFLICT
Content: { "message" : "ERROR: null value in column "user_account" violates not-null constraint" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard "name" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard "icon" parameter cannot be empty" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{ "name" : "default_admin", "icon" : "admin", "user" : "/rest/repository/users/1" }' http://localhost:8080/rest/repository/dashboards
#### Update dashboard
URL /rest/repository/dashboards/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "name" : [string], "icon" : [string], "user" : [URI] }
Success Response Code: 200 OK
Content: { "name" : [string], "icon" : [string], "user" : [URI] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (name)=[string] already exists." }
OR
Code: 409 CONFLICT
Content: { "message" : "ERROR: null value in column "user_account" violates not-null constraint" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard "name" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard "icon" parameter cannot be empty" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{ "name" : "default_admin", "icon" : "admin", "user" : "/rest/repository/users/1" }' http://localhost:8080/rest/repository/dashboards/1
#### Find one dashboard
URL GET
Method /rest/repository/dashboards/:id
URL Params Required:id=[integer]
Data Params None
Success Response Code: 200 OK
Content: { "name" : [string], "icon" : [string], "user" : [URI] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboards/1
#### Find one dashboard by name
URL GET
Method /rest/repository/dashboards/search/findByName
URL Params Required:name=[string]
Data Params None
Success Response Code: 200 OK
Content: { "name" : [string], "icon" : [string], "user" : [URI] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboards/search/findByName?name=someName
#### Find all dashboards
URL /rest/repository/dashboards/search/findAll
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: { "_embedded": {"dashboards": [ { "name" : [string], "icon" : [string], "user" : [URI] }, ... ] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboards/search/findAll
#### Delete dashboard
URL /rest/repository/dashboards/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/dashboards/1
### DashboardBox CRUD methods #### Create dashboardBox
URL /rest/repository/dashboard-boxes
Method POST
URL Params None
Data Params Required: { "name" : [string], "description" : [string], "order" : [integer], "width" : [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100], "height" : [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100], "dashboard" : [URI], "dashboardBoxType" : [URI] }
Success Response Code: 201 CREATED
Content: { "name" : [string], "description" : [string], "order" : [integer], "width" : [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100], "height" : [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100]" }
Error Response Code: 409 CONFLICT
Content: { "message" : "ERROR: null value in column "dashboard" violates not-null constraint" }
OR
Code: 409 CONFLICT
Content: { "message" : "ERROR: null value in column "dashboard_box_type" violates not-null constraint" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "order" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "name" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "description" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "width" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "height" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.dashboard.Width from String [string]: value not one of declared Enum instance names: [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100]" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.dashboard.Height from String [string]: value not one of declared Enum instance names: [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100]" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{ "name" : "new dashboardBox", "description" : "new dashboardBox desc", "order" : 50, "width" : "WIDTH_25", "height" : "HEIGHT_25", "dashboard" : "/rest/repository/dashboards/1", "dashboardBoxType" : "/rest/repository/dashboard-box-types/2" }' http://localhost:8080/rest/repository/dashboard-boxes
#### Update dashboardBox
URL /rest/repository/dashboard-boxes/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "name" : [string], "description" : [string], "order" : [integer], "width" : [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100], "height" : [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100], "dashboard" : [URI], "dashboardBoxType" : [URI] }
Success Response Code: 200 OK
Content: { "name" : [string], "description" : [string], "order" : [integer], "width" : [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100], "height" : [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100] }
Error Response Code: 409 CONFLICT
Content: { "message" : "ERROR: null value in column "dashboard" violates not-null constraint" }
OR
Code: 409 CONFLICT
Content: { "message" : "ERROR: null value in column "dashboard_box_type" violates not-null constraint" }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "order" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "name" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "description" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "width" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box "height" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.dashboard.Width from String [string]: value not one of declared Enum instance names: [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100]" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.dashboard.Height from String [string]: value not one of declared Enum instance names: [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100]" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{ "name" : "new dashboardBox", "description" : "new dashboardBox desc", "order" : 50, "width" : "WIDTH_25", "height" : "HEIGHT_25", "dashboard" : "/rest/repository/dashboards/1", "dashboardBoxType" : "/rest/repository/dashboard-box-types/2" }' http://localhost:8080/rest/repository/dashboard-boxes/1
#### Find one dashboardBox
URL /rest/repository/dashboard-boxes/:id
Method GET
URL Params Required:id=[integer]
Data Params None
Success Response Code: 200 OK
Content: { "name" : [string], "description" : [string], "order" : [integer], "width" : [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100], "height" : [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboard-boxes/1
#### Find all dashboardBoxes
URL /rest/repository/dashboard-boxes/search/findAll
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: { "_embedded": {"dashboard-boxes": [ { "name" : [string], "description" : [string], "order" : [integer], "width" : [WIDTH_25,WIDTH_50,WIDTH_75,WIDTH_100], "height" : [HEIGHT_25,HEIGHT_50,HEIGHT_75,HEIGHT_100] }, ... ] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboard-boxes/search/findAll
#### Delete dashboardBox
URL /rest/repository/dashboard-boxes/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/dashboard-boxes/1
### DashboardBoxType CRUD methods #### Create dashboardBoxType
URL /rest/repository/dashboard-box-types
Method POST
URL Params None
Data Params Required: { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }
Success Response Code: 201 CREATED
Content: { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (name)=[string] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box type "name" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box type "type" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box type "kind" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.dashboard.Kind from String [string]: value not one of declared Enum instance names: [PIE_CHART, SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS,PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS]" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Can not deserialize value of type io.smsc.model.dashboard.Type from String [string]: value not one of declared Enum instance names: [STATUS,CHART]" }
Sample Call curl -X POST -H "Content-Type: application/json" -d '{ "name" : "new dashboard box type", "type" : "CHART", "kind" : "BAR_CHART" }' http://localhost:8080/rest/repository/dashboard-box-types
#### Update dashboardBoxType
URL /rest/repository/dashboard-box-types/:id
Method PUT
URL Params Required:id=[integer]
Data Params Required: { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }
Success Response Code: 200 OK
Content: { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }
Error Response Code: 409 CONFLICT
Content: { "message": "ERROR: duplicate key value violates unique constraint. Detail: Key (name)=[string] already exists." }
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box type "name" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box type "type" parameter cannot be empty" }
OR
Code: 400 BAD REQUEST
Content: { "message" : "Dashboard box type "kind" parameter cannot be empty" }
Sample Call curl -X PUT -H "Content-Type: application/json" -d '{ "name" : "new dashboard box type", "type" : "CHART", "kind" : "BAR_CHART" }' http://localhost:8080/rest/repository/dashboard-box-types/1
#### Find one dashboardBoxType
URL /rest/repository/dashboard-box-types/:id
Method GET
URL Params Required:id=[integer]
Data Params None
Success Response strong>Code: 200 OK
Content: { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboard-box-types/1
#### Find one dashboardBoxType by name
URL /rest/repository/dashboard-box-types/search/findByName
Method GET
URL Params Required:name=[string]
Data Params None
Success Response strong>Code: 200 OK
Content: { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboard-box-types/search/findByName?name=someName
#### Find all dashboardBoxTypes
URL /rest/repository/dashboard-box-types/search/findAll
Method GET
URL Params None
Data Params None
Success Response Code: 200 OK
Content: { "_embedded": {"dashboard-box-types": [ { "name" : [string], "type" : [STATUS,CHART], "kind" : [PIE_CHART,SERIAL_CHART,LINE_CHART,BAR_CHART,BUBBLE_CHART,FEEDBACK_STATUS, PROFIT_STATUS,ORDERS_STATUS,USERS_STATUS] }, ... ] }
Error Response Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl http://localhost:8080/rest/repository/dashboard-box-types/search/findAll
#### Delete dashboardBoxType
URL /rest/repository/dashboard-box-types/:id
Method DELETE
URL Params Required:id=[integer]
Data Params None
Success Response Code: 204 NO CONTENT
Error Response Code: 404 NOT FOUND
OR
Code: 401 UNAUTHORIZED
Content: { "message": "Unauthorized or token is expired. Please login with valid credentials" }
Sample Call curl -X DELETE http://localhost:8080/rest/repository/dashboard-box-types/1

Notes

Each request should contain header with valid and not expired Access token. Header name is "X-Authorization" by default and can be changed using System properties (property name - jwt.header).