An API that will take control over the healthcare institution registration as well as the exams ingest.
- Java SE Development Kit 8 or higher;
- Maven 2.0.9 or higher;
- MySQL 5.0 or higher (The configuration of the connection can be done by editing the
\main\resources\application.properties
file or with theDATASOURCE_HOST
,DATASOURCE_SCHEMA
,DATASOURCE_USERNAME
andDATASOURCE_PASSWORD
environment variables).
mvn spring-boot:run
The API description and try-out methods can be viewed in the following URL:
/swagger-ui.html
An API that will take control over the healthcare institution registration.
Creates a single Healthcare Institution. The token returned needs to be used as Beared Authentication Header for exams API.
-
URL
/healthcareinstitutions/
-
Method:
POST
-
Data Params
Required:
Name=[alphanumeric]
CNPJ=[alphanumeric]
-
Success Response:
- Code: 200
Content:{ "Name": "lucasbernardo.org", "CNPJ": "16191374000171", "token": "XXXXXX.XXXXXXXXXXXXX" }
- Code: 200
-
Error Response:
- Code: 500 INTERNAL SERVER ERROR
Content:{ "cnpj": "Duplicate entry '16191374000171' for key 'CNPJ'" }
OR
- Code: 400 BAD REQUEST
Content:{ "cnpj": "CNPJ is mandatory." }
OR
- Code: 400 BAD REQUEST
Content:{ "cnpj": "Invalid CNPJ." }
- Code: 500 INTERNAL SERVER ERROR
-
Sample Call:
$.ajax({ url: '/exams/', method: 'POST', timeout: 0, dataType: 'json', data: JSON.stringify({ Name: 'lucasbernardo.org', CNPJ: '16.191.374/0001-71' }) }).done(function (response) { console.log(response); });
An API that will take control over the exam ingest. The Beared Authentication Header is required and can be obtain creating a healthcare institution.
Creates a single Exam. This resource charges 1 pixeon.
-
URL
/exams/
-
Method:
POST
-
Data Params
Required:
PatientName=[alphanumeric]
PatientAge=[integer]
PatientAge=[enum(M or F)]
PhysicianName=[alphanumeric]
PhysicianCRM=[alphanumeric]
ProcedureName=[alphanumeric]
-
Success Response:
- Code: 200
Content:
{ "id": 6, "healthcareInstitution": { "Name": "lucasbernardo.org", "CNPJ": "16191374000171" }, "PatientName": "John Doe", "PatientAge": 55, "PatientGender": "M", "PhysicianName": "Taylor Joe", "PhysicianCRM": "45465223", "ProcedureName": "MRI" }
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
Content:{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
- Code: 401 UNAUTHORIZED
Content:{ "error": "The resource is secured and no token was informed." }
OR
- Code: 400 BAD REQUEST
Content:{ "patientName": "PatientName is mandatory." }
OR
- Code: 400 BAD REQUEST
Content:{ "patientGender": "PatientGender must be \"M\" or \"F\"." }
OR
- Code: 400 BAD REQUEST
Content:{ "patientAge": "PatientAge should be a positive integer." }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "HealthcareInstitution": "Out of budget." }
- Code: 401 UNAUTHORIZED
-
Sample Call:
$.ajax({ url: '/exams/', method: 'POST', timeout: 0, dataType: 'json', "headers": { "Content-Type": "application/json", "Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX" }, data: JSON.stringify({ PatientName: 'John Doe', PatientAge: 55, PatientGender: 'M', PhysicianName: 'Taylor Joe', PhysicianCRM: '45465223', ProcedureName: 'MRI' }) }).done(function (response) { console.log(response); });
Update data of an existent Exam.
-
URL
/exams/:id/
-
Method:
PUT
-
URL Params
Required:
id=[integer]
-
Data Params
Required:
PatientName=[alphanumeric]
PatientAge=[integer]
PatientAge=[enum(M or F)]
PhysicianName=[alphanumeric]
PhysicianCRM=[alphanumeric]
ProcedureName=[alphanumeric]
-
Success Response:
- Code: 200
Content:
{ "id": 6, "healthcareInstitution": { "id": 1, "Name": "lucasbernardo.org", "CNPJ": "16191374000171" }, "PatientName": "John Doe", "PatientAge": 55, "PatientGender": "M", "PhysicianName": "Taylor Joe", "PhysicianCRM": "45465223", "ProcedureName": "MRI" }
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
Content:{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
- Code: 401 UNAUTHORIZED
Content:{ "error": "The resource is secured and no token was informed." }
OR
- Code: 404 NOT FOUND
Content:{ "Exam": "id \"2\" not found." }
OR
- Code: 400 BAD REQUEST
Content:{ "patientName": "PatientName is mandatory." }
OR
- Code: 400 BAD REQUEST
Content:{ "patientGender": "PatientGender must be \"M\" or \"F\"." }
OR
- Code: 400 BAD REQUEST
Content:{ "patientAge": "PatientAge should be a positive integer." }
- Code: 401 UNAUTHORIZED
-
Sample Call:
$.ajax({ url: '/exams/6', method: 'PUT', timeout: 0, dataType: 'json', "headers": { "Content-Type": "application/json", "Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX" }, data: JSON.stringify({ PatientName: 'John Doe', PatientAge: 55, PatientGender: 'M', PhysicianName: 'Taylor Joe', PhysicianCRM: '45465223', ProcedureName: 'MRI' }) }).done(function (response) { console.log(response); });
Delete an existent Exam.
-
URL
/exams/:id/
-
Method:
DELETE
-
URL Params
Required:
id=[integer]
-
Success Response:
- Code: 200
Content:{ "deleted": true }
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
Content:{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
- Code: 401 UNAUTHORIZED
Content:{ "error": "The resource is secured and no token was informed." }
OR
- Code: 404 NOT FOUND
Content:{ "Exam": "id \"2\" not found." }
- Code: 401 UNAUTHORIZED
-
Sample Call:
$.ajax({ url: '/exams/6', method: 'DELETE', timeout: 0, "headers": { "Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX" } }).done(function (response) { console.log(response); });
Retrieve a previously created Exam. Charges 1 pixeon in the first call of every exam.
-
URL
/exams/:id/
-
Method:
GET
-
URL Params
Required:
id=[integer]
-
Success Response:
- Code: 200
Content:
{ "id": 6, "healthcareInstitution": { "id": 1, "Name": "lucasbernardo.org", "CNPJ": "16191374000171" }, "PatientName": "John Doe", "PatientAge": 55, "PatientGender": "M", "PhysicianName": "Taylor Joe", "PhysicianCRM": "45465223", "ProcedureName": "MRI" }
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
Content:{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
- Code: 401 UNAUTHORIZED
Content:{ "error": "The resource is secured and no token was informed." }
OR
- Code: 404 NOT FOUND
Content:{ "Exam": "id \"2\" not found." }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "HealthcareInstitution": "Out of budget." }
- Code: 401 UNAUTHORIZED
-
Sample Call:
$.ajax({ url: '/exams/6', method: 'GET', "headers": { "Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX" }, timeout: 0 }).done(function (response) { console.log(response); });