Table of Contents maxLevel 3 minLevel 3
...
- Resource: "offices"
- Method: POST
- Description: Lists all the offices in the database. When office information is printed, all the employees that belong to an office are also printed using a nested query, which refers to the employeesInOfficeSQL query.
- Resource: "boston_customers"
- Method: GET
- Description: Returns all the customers in Boston.
- Resource: "employee/{employeeNumber}"
- Method: GET
- Description: Returns employee information for the given employee number.
- Resource: "employee"
- Method: POST
- Description: Insert a new employee to the database with the given information.
- Resource: "employee" with batch request
- Method: POST
- Description: Insert a set of new employees to the database with the given information.
- Resource: "employee"
- Method: PUT
- Description: Updates an existing user with new information.
- Resource: "employee
- Method: GET
- Description: Retrieve an existing employee.
...
The HTTP requests sent for each of the resources using cURL would be as follows:
"offices" (method=GET)
Code Block curl -X GET -H "Accept: application/json" http://localhost:9763/services/samples/JSONSample/offices
"boston_customers" (method=GET)
Code Block curl -X GET -H "Accept: application/json" http://localhost:9763/services/samples/JSONSample/boston_customers
"employee/{employeeNumber}" (method=GET)
Code Block curl -X GET -H "Accept: application/json" http://localhost:9763/services/samples/JSONSample/employee/1002
"employee" (method=POST) : A sample payload saved as the employee-payload.json file, that can be used when sending the data is given below.
Code Block { "_postemployee": { "employeeNumber" : "14001", "lastName": "Smith", "firstName": "Will", "email": "will@google.com", "salary": "15500.0" } }
The HTTP request sent using CURL would be as follows:
Code Block curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@employee-payload.json" http://localhost:9763/services/samples/JSONSample/employee/
"employee" (method=POST) with batch request : A sample payload saved as the employee-payload.json file, that can be used when sending the data is given below.
Code Block { "_postemployee_batch_req": { "_postemployee": [ { "employeeNumber": "5012", "lastName": "Smith", "firstName": "Will", "email": "will@smith.com", "salary": "13500.0" }, { "employeeNumber": "5013", "lastName": "Peter", "firstName": "Parker", "email": "peter@parker.com", "salary": "15500.0" } ] } }
The HTTP request sent using CURL would be as follows:
Code Block curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@employee-payload.json" http://localhost:9763/services/samples/JSONSample/employee_batch_req
"employee" (method=PUT) - A sample payload saved as the employee-payload-update.json file, that can be used when sending the data is given below.
Code Block { "_putemployee": { "employeeNumber" : "14001", "lastName": "Smith", "firstName": "Will", "email": "will@smith.com", "salary": "78500.0" } }
The HTTP request sent using CURL would be as follows:Code Block curl -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' --data "@employee-payload-update.json" http://localhost:9763/services/samples/JSONSample/employee/
"employee" (method=GET)
Code Block curl -X GET -H 'Accept: application/json' http://localhost:9763/services/samples/JSONSample/employee/14001