Skip to content

API Docs

Ryan1Up edited this page May 2, 2022 · 44 revisions

API Documentation

Description:

This page documents the API endpoints included in this project. The contain the relative path, Method, Body, Parameters, and expected Response Bodies.

Table of Contents


NOTICE:

WHEN MAKING ANY REQUEST OTHER THAN BUSINESS REGISTRATION OR LOGIN, YOU MUST ALWAYS SUBMIT THE FOLLOWING THAT WAS PROVIDED TO YOU AS A RESULT OF THE BUSINESS_REGISTRATION OR LOGIN REQUEST:

    "token": "a13451d11b8837f60d0ab1870084b9f5168fe21d8c17e4ae299484c60c6440a0",
    "accountId": {
        "accountIdString": "29c1563b-1d7b-4a63-bb12-5691592af0cb",
        "email": "someEmail",
        "businessId": 100
    }

Accounts

Registration

Business Registration

Description:
This endpoint allows a user to create a new Business Account by providing a Business Name, and other Account Registration information such as email, password, names, and job title. The founding account will by default be an Admin Account

PATH:
/api/v1/accounts/register_business

METHOD: 
POST 

BODY:
{
    "token": "someToken",
    "email": "someEmail",
    "businessName": "businessName",
    "firstName": "FirstName",
    "lastName": "LastName",
    "password": "somePassword",
    "jobTitle": "Admin"
}


RESPONSE:
{
    "businessId": 100,
    "email": "someEmail",
    "password": null,
    "firstName": "FirstName",
    "lastName": "LastName",
    "timestamp": "2022-04-14T02:16:39.432+00:00",
    "jobTitle": "Admin",
    "token": "6aaaea0f137e3239508ab42173446f8e2884357440a83674e86d3c23a18105b1",
    "accountId": {
        "accountIdString": "90f0e832-fbb3-4d30-b669-9dcbd1b53672",
        "email": "someEmail",
        "businessId": 100
    },
    "accountIdString": "90f0e832-fbb3-4d30-b669-9dcbd1b53672"
}

Admin Registration

Description:
New Worker accounts, can only be created by Admin Accounts of the same business. To create a new account, you will need all the new account information plus the requesting account id.

PATH:
/api/v1/accounts/register_admin

METHOD:
POST

BODY:
{
    "token": "a13451d11b8837f60d0ab1870084b9f5168fe21d8c17e4ae299484c60c6440a0",
    "accountId": {
        "accountIdString": "29c1563b-1d7b-4a63-bb12-5691592af0cb",
        "email": "someEmail",
        "businessId": 100
    },
    "email": "newEmail",
    "firstName": "newFirstName",
    "lastName": "newLastName",
    "password": "newsomePassword",
    "jobTitle": "newAdmin"

}


RESPONSE:
HTTPStatus: 200

Employee Registration

Description:
New Worker accounts, can only be created by Admin Accounts of the same business. To create a new account, you will need all the new account information plus the requesting account id.

PATH:
/api/v1/accounts/register_employee

METHOD:
POST 

BODY:
{
    "token": "a13451d11b8837f60d0ab1870084b9f5168fe21d8c17e4ae299484c60c6440a0",
    "accountId": {
        "accountIdString": "29c1563b-1d7b-4a63-bb12-5691592af0cb",
        "email": "someEmail",
        "businessId": 100
    },
    "email": "newEmailEmp",
    "firstName": "newFirstNameEmp",
    "lastName": "newLastNameEmp",
    "password": "newsomePasswordEmp",
    "jobTitle": "newAdminEmp"

}


RESPONSE:
HTTPStatus: 200

Session

Login

Description:
The use will log in using their email, password, and Business ID provided to them by their employer.

PATH:
api/v1/account/login

METHOD:
POST

BODY:
{
    "email": "someEmail",
    "password": "somePassword",
    "businessId": 100
}

RESPONSE:
{
    "businessId": 100,
    "email": "someEmail",
    "password": null,
    "firstName": "FirstName",
    "lastName": "LastName",
    "timestamp": "2022-04-14T02:38:55.385+00:00",
    "jobTitle": "Admin",
    "token": "01090f1a5ae3b0b9e7afe3deb7f377e75c0731df120eef74a685d341d6f2df75",
    "accountId": {
        "accountIdString": "5f8d5979-718e-48c1-813c-60168cb04fc8",
        "email": "someEmail",
        "businessId": 100
    },
    "accountIdString": "5f8d5979-718e-48c1-813c-60168cb04fc8"
}

Logout

Description:
The user will logout using the same authentication credentials they use for all other transactions, the Token, and accountId made of the accountIdString, email, and BusinessId. Logging out invalidates the token. Any further requests made with this token will be rejected

PATH: 
api/v1/accounts/logout  

METHOD:
PUT

BODY:
{
    "token": "01090f1a5ae3b0b9e7afe3deb7f377e75c0731df120eef74a685d341d6f2df75",
    "accountId": {
        "accountIdString": "5f8d5979-718e-48c1-813c-60168cb04fc8",
        "email": "someEmail",
        "businessId": 100
    }
}

RESPONSE:
HTTPStatus: 200

Management

Get Account Info

Description:
A user is entitled to retrieving their own account info. The standard request parameters are required in the body. As always the password field is nulled upon return.

PATH:
api/v1/accounts/my_account_info

METHOD:
POST

BODY:
 {
    "token": "01090f1a5ae3b0b9e7afe3deb7f377e75c0731df120eef74a685d341d6f2df75",
    "accountId": {
        "accountIdString": "5f8d5979-718e-48c1-813c-60168cb04fc8",
        "email": "someEmail",
        "businessId": 100
    }
}

RESPONSE:
{
    "businessId": 100,
    "email": "someEmail",
    "password": null,
    "firstName": "FirstName",
    "lastName": "LastName",
    "timestamp": "2022-04-14T02:38:55.385+00:00",
    "jobTitle": "Admin",
    "token": null,
    "accountId": {
        "accountIdString": "5f8d5979-718e-48c1-813c-60168cb04fc8",
        "email": "someEmail",
        "businessId": 100
    },
    "accountIdString": "5f8d5979-718e-48c1-813c-60168cb04fc8"
}

Other Account Info

Description:
If a user has the required permission, they can get the account information of other accounts. By default all admin accounts have this permission.

PATH:
api/v1/accounts/get_other_account_info

METHOD:
POST

BODY:
{
    "token": "38e806bed4dda4651fc7d3c50218298d3be1f3fcf5c20f2c6005c1b6dd1632cb",
    "accountId": {
        "accountIdString": "9c13033c-f354-4b8f-837a-239c1528344d",
        "email": "someEmail",
        "businessId": 100
    },
    "targetId": {
        "accountIdString": null,
        "email": "newEmail",
        "businessId": 100
    }
}

RESPONSE:

{
    "businessId": 100,
    "email": "newEmail",
    "password": null,
    "firstName": "newFirstName",
    "lastName": "newLastName",
    "timestamp": "2022-04-14T03:29:37.795+00:00",
    "jobTitle": "newAdmin",
    "token": null,
    "accountId": {
        "accountIdString": "5b1cc20e-a352-4c9f-82ba-b38ba8055b9a",
        "email": "newEmail",
        "businessId": 100
    },
    "accountIdString": "5b1cc20e-a352-4c9f-82ba-b38ba8055b9a"
}

All Other Accounts Info

Description:
For certain functions, a user may want quick access to all other accounts connected to their business.

PATH:
api/v1/accounts/get_accounts

METHOD:
POST 
  
BODY:
{
    "token": "c8b2e18a1eb05351e48dc95db9372f891aefbba3f16a7b16a1a46e4209b52e0b",
    "accountId": {
        "accountIdString": "9d57b48e-e2cc-4542-9296-74803d7ca102",
        "email": "someEmail",
        "businessId": 100
    }
}

RESPONSE:
[
    {
        "businessId": 100,
        "email": "someEmail",
        "password": null,
        "firstName": "FirstName",
        "lastName": "LastName",
        "timestamp": "2022-04-26T23:17:17.676+00:00",
        "jobTitle": "Admin",
        "token": null,
        "accountId": {
            "accountIdString": "9d57b48e-e2cc-4542-9296-74803d7ca102",
            "email": "someEmail",
            "businessId": 100
        },
        "accountIdString": "9d57b48e-e2cc-4542-9296-74803d7ca102"
    },
    {
        "businessId": 100,
        "email": "newEmail",
        "password": null,
        "firstName": "newFirstName",
        "lastName": "newLastName",
        "timestamp": "2022-04-27T00:22:37.803+00:00",
        "jobTitle": "newAdmin",
        "token": null,
        "accountId": {
            "accountIdString": "dafdb3fb-f8c9-449c-9650-28b21b94d2fe",
            "email": "newEmail",
            "businessId": 100
        },
        "accountIdString": "dafdb3fb-f8c9-449c-9650-28b21b94d2fe"
    }
]

Updating Account

Description: Each user can update their own information. This endpoint allows this.

PATH:
api/v1/accounts/update_info

METHOD:
PUT

BODY:
{
    "token": "c6f1f9385c117ff6be9eaf6b92fed0918a58f7b3652349013f53604715381069",
    "accountId": {
        "accountIdString": "c76ce0d6-0c0f-44dc-9fb4-ea823c8018c6",
        "email": "someEmail",
        "businessId": 100
    },
    "firstName": "Malee",
    "lastName": "Seechan",
    "password": "My new Password",
    "jobTitle": "Front-End Dev"
}

RESPONSE:
{
    "businessId": 100,
    "email": "someEmail",
    "password": null,
    "firstName": "Malee",
    "lastName": "Seechan",
    "timestamp": "2022-04-29T03:55:16.632+00:00",
    "jobTitle": "Front-End Dev",
    "token": null,
    "accountId": {
        "accountIdString": "215c3285-3f0f-4173-8f44-b5fe10a6d918",
        "email": "someEmail",
        "businessId": 100
    },
    "accountIdString": "215c3285-3f0f-4173-8f44-b5fe10a6d918"
}

Updating Other Accounts

Description:
If a user has the permission, or is an admin, they can update another accounts information. This is useful for updating a name change, position change, or even a password change

PATH:
api/v1/accounts/update_other_info

METHOD:
PUT

BODY:
{
    "token": "c6f1f9385c117ff6be9eaf6b92fed0918a58f7b3652349013f53604715381069",
    "accountId": {
        "accountIdString": "c76ce0d6-0c0f-44dc-9fb4-ea823c8018c6",
        "email": "someEmail",
        "businessId": 100
    },
    "targetId": {
        "accountIdString": "a98c8937-112a-4218-9d8e-e74999880fd9",
        "email": "newEmail",
        "businessId": 100
    },
    "firstName": "Malee",
    "lastName": "Seechan",
    "password": "My new Password",
    "jobTitle": "Front-End Dev"
}

RESPONSE:
{
    "businessId": 100,
    "email": "newEmail",
    "password": null,
    "firstName": "Malee",
    "lastName": "Seechan",
    "timestamp": "2022-04-27T00:38:10.728+00:00",
    "jobTitle": "Front-End Dev",
    "token": null,
    "accountId": {
        "accountIdString": "a98c8937-112a-4218-9d8e-e74999880fd9",
        "email": "newEmail",
        "businessId": 100
    },
    "accountIdString": "a98c8937-112a-4218-9d8e-e74999880fd9"
}

Update Permissions

Description:
An Admin can update the permissions of an employee account. Permissions are as follows:

Permission Code Description
REPORT_CREATE Create Reports
REPORT_EDIT Edit Reports
REPORT_DELETE Delete Reports
REPORT_FORMAT Set the Report Format for the business
UPDATE_CREATE Create Updates
UPDATE_EDIT Edit Updates
UPDATE_DELETE Delete Updates
ATTACHMENTS_CREATE Create Attachments
ATTACHMENTS_DELETE Delete Attachments
IMAGES_CREATE Create Images
IMAGES_EDIT Edit Images
PROFILES_CREATE Create Profiles
PROFILES_EDIT Edit Profiles
PROFILES_DELETE Delete Profiles
PROFILES_FORMAT Set the Profile format for the business
NOTIFICATIONS_EDIT Enable/Disable Notifications
ACCOUNTS_REGISTER Register other accounts
ACCOUNTS_PROMOTE Promote other accounts
ACCOUNTS_DEMOTE Demote other accounts
ACCOUNTS_VIEW View other accounts info
ACCOUNTS_UPDATE Update other accounts info
PERMISSIONS_EDIT Edit an employees permissions
PATH:
api/v1/accounts/update_permissions

METHOD:
PUT

BODY:
{
    "token": "ebe010cfcb4b525b1967d00f61ecc6626d6cb3e900ca1b9bd13d65f08f3a68c2",
    "accountId": {
        "accountIdString": "0fe022f5-6254-4e2b-b69f-05aa36a802e1",
        "email": "someEmail",
        "businessId": 100
    },
    "targetId": {
        "accountIdString": "334ff6ae-ca75-4e37-a0b6-3a704e3078c6",
        "email": "newEmailEmp",
        "businessId": 100
    },
    "permissions": ["REPORT_CREATE", "REPORT_DELETE", "REPORT_EDIT", "UPDATE_CREATE", "UPDATE_DELETE"]
}


RESPONSE:
{
    "businessId": 100,
    "email": "newEmailEmp",
    "password": null,
    "firstName": "newFirstNameEmp",
    "lastName": "newLastNameEmp",
    "timestamp": "2022-04-15T05:16:43.965+00:00",
    "jobTitle": "newAdminEmp",
    "token": null,
    "accountId": {
        "accountIdString": "334ff6ae-ca75-4e37-a0b6-3a704e3078c6",
        "email": "newEmailEmp",
        "businessId": 100
    },
    "permissionsList": [
        "REPORT_CREATE", 
        "REPORT_DELETE", 
        "REPORT_EDIT", 
        "UPDATE_CREATE", 
        "UPDATE_DELETE"
    ],
    "accountIdString": "334ff6ae-ca75-4e37-a0b6-3a704e3078c6"
}

Promote Account

Description:
An Admin is allowed to Promote another account to Admin account if it is not already one.

PATH:
api/v1/accounts/promote

METHOD:
PUT

BODY:
{
    "token": "a98e0d0b5bc32af42cc39bd5c7d45933c6bf24dd51ffc3c2730ca861db7d8109",
    "accountId": {
        "accountIdString": "349aea79-caef-49d0-950b-9a1665b8fe1e",
        "email": "someEmail",
        "businessId": 100
    },
    "targetId": {
        "accountIdString": "4fa168b7-bbb6-4493-9a3d-815db7b608de",
        "email": "newEmail",
        "businessId": 100
    }
}


RESPONSE:
{
    "businessId": 100,
    "email": "newEmail",
    "password": null,
    "firstName": "newFirstName",
    "lastName": "newLastName",
    "timestamp": "2022-04-15T04:37:12.078+00:00",
    "jobTitle": "newAdmin",
    "token": null,
    "accountId": {
        "accountIdString": "4fa168b7-bbb6-4493-9a3d-815db7b608de",
        "email": "newEmail",
        "businessId": 100
    },
    "accountIdString": "4fa168b7-bbb6-4493-9a3d-815db7b608de"
}

Demote Account

Description:
In some cases, it may be necessary for an Admin account to be Demoted to a regular Employee Account. This can only be done by another admin account.

PATH:
/api/v1/accounts/demote

METHOD:
PUT

BODY:
{
    "token": "a98e0d0b5bc32af42cc39bd5c7d45933c6bf24dd51ffc3c2730ca861db7d8109",
    "accountId": {
        "accountIdString": "349aea79-caef-49d0-950b-9a1665b8fe1e",
        "email": "someEmail",
        "businessId": 100
    },
    "targetId": {
        "accountIdString": "4fa168b7-bbb6-4493-9a3d-815db7b608de",
        "email": "newEmail",
        "businessId": 100
    }
}


RESPONSE:
{
    "businessId": 100,
    "email": "newEmail",
    "password": null,
    "firstName": "newFirstName",
    "lastName": "newLastName",
    "timestamp": "2022-04-15T04:37:50.201+00:00",
    "jobTitle": "newAdmin",
    "token": null,
    "accountId": {
        "accountIdString": "4fa168b7-bbb6-4493-9a3d-815db7b608de",
        "email": "newEmail",
        "businessId": 100
    },
    "permissionsList": [],
    "accountIdString": "4fa168b7-bbb6-4493-9a3d-815db7b608de"
}

Auth

Validate

Description:
For use with other micro-services, this endpoint will validate if a token is active and non-expired. If the token is validated, it will return a 200 Ok Status. Otherwise it will return an Error.

PATH:
api/v1/auth/validate  
  
METHOD: 
POST  
  
BODY:
{
    "token": "a98e0d0b5bc32af42cc39bd5c7d45933c6bf24dd51ffc3c2730ca861db7d8109",
    "accountId": {
        "accountIdString": "349aea79-caef-49d0-950b-9a1665b8fe1e",
        "email": "someEmail",
        "businessId": 100
    }
}
 
RESPONSE:  
HTTP 200 OK, Or HTTP 500 Error

Invalidate

Description: While not intended for use directly, a user can be effectively 'logged out' when their token is invalidated. This endpoint allows for redundant invalidation.

PATH:
api/v1/auth/invalidate  
  
METHOD: 
POST  
  
BODY:
{
    "token": "a98e0d0b5bc32af42cc39bd5c7d45933c6bf24dd51ffc3c2730ca861db7d8109",
    "accountId": {
        "accountIdString": "349aea79-caef-49d0-950b-9a1665b8fe1e",
        "email": "someEmail",
        "businessId": 100
    }
}
 
RESPONSE:  
HTTP 200 OK, Or HTTP 500 Error

Refresh

Description:
This endpoint will refresh a token. By default a token has a limited amount of time to be validated, by refreshing it, that time will get extended, effectively allowing a user to maintain a session.

PATH:
api/v1/auth/refresh
  
METHOD: 
POST  
  
BODY:
{
    "token": "a98e0d0b5bc32af42cc39bd5c7d45933c6bf24dd51ffc3c2730ca861db7d8109",
    "accountId": {
        "accountIdString": "349aea79-caef-49d0-950b-9a1665b8fe1e",
        "email": "someEmail",
        "businessId": 100
    }
}
 
RESPONSE:  
HTTP 200 OK, Or HTTP 500 Error

Reports

Report Format

Set Report Format

Description: By default, each business is initialized with an empty report format. Thus during registration it is recommended to have the client fill out a "Report Format" form. To do so, the HTTP Body must include the standard identifiers, as well as a JSON Object labeled "reportFormat" with the desired fields. All fields not desired are to be assigned false.

PATH:  
api/v1/reports/set_report_format  

METHOD:
POST  
  
BODY
{
    "token": "87a06f03946c8c20fc92163af9517d9ef71e0046696b7823579f3ef12e94e96a",
    "accountId": {
        "accountIdString": "3960ab55-a7ad-46dd-998f-0f13c7316caf",
        "email": "someEmail",
        "businessId": 100
    },
    "reportFormat": {
        "businessId": 100,
        "reportId" : true,
        "profiles" : true,
        "date": true,
        "time": true,
        "author": true,
        "type": true,
        "box1" :true,
        "box1Name": "Source of Activity",
        "box2": true,
        "box2Name":"Investigation",
        "box3": true,
        "box3Name": "Resolution",
        "box4": true,
        "box4Name": "Conclusion",
        "box5": true,
        "box5Name": "Dispositional Information",
        "attachments": true,
        "changeLog": true
    }
}  
  
RESPONSE:
HTTP Status 200 OK

Get Report Format

Description:
For displaying purposes, the client is able to retrieve a respective users "Business'" Report format. To do so, simply submit the standard identifying information.

PATH:
api/v1/reports/get_report_format

METHOD:
POST

BODY:
{
    "token": "87a06f03946c8c20fc92163af9517d9ef71e0046696b7823579f3ef12e94e96a",
    "accountId": {
        "accountIdString": "3960ab55-a7ad-46dd-998f-0f13c7316caf",
        "email": "someEmail",
        "businessId": 100
    }
}

RESPONSE:
{
    "businessId": 100,
    "reportId": true,
    "profiles": true,
    "date": true,
    "time": true,
    "author": true,
    "type": true,
    "box1": true,
    "box1Name": "Source of Activity",
    "box2": true,
    "box2Name": "Investigation",
    "box3": true,
    "box3Name": "Resolution",
    "box4": true,
    "box4Name": "Conclusion",
    "box5": true,
    "box5Name": "Dispositional Information",
    "attachments": true,
    "changeLog": true
}  

Profile Formats

Set Profile Format

Description:
The client is allowed to set which fields they would like to track data for on a profile. Each Business account will initialized with an empty Profile Format, so it is recommended to have this set during the registration process.

PATH
api/v1/reports/set_profile_format

METHOD:
POST

BODY:
{
    "token": "ba7a95e83564895750a2a0fc909efe5dfbc11fe4504c9953a66735afc449f167",
    "accountId": {
        "accountIdString": "973263fd-822b-42c5-bd1b-8b9ea6da8c6d",
        "email": "someEmail",
        "businessId": 100
    },
    "profileFormat":{
        "businessId" : 100,
        "name": true,
        "status": true,
        "address": true,
        "banDuration": true,
        "attributes" : true,
        "imageName": true,
        "involvement": true,
        "reports": true
    }
}

RESPONSE:
HTTP STATUS 200 OK

Get Profile Format

Description:
Returns the Profile fields that are tracked by the business.

PATH:
api/v1/reports/get_profile_format

METHOD:
POST

BODY:
{
    "token": "ba7a95e83564895750a2a0fc909efe5dfbc11fe4504c9953a66735afc449f167",
    "accountId": {
        "accountIdString": "973263fd-822b-42c5-bd1b-8b9ea6da8c6d",
        "email": "someEmail",
        "businessId": 100
    }
}

RESPONSE:
{
    "businessId": 100,
    "name": true,
    "status": true,
    "address": true,
    "banDuration": true,
    "attributes": true,
    "imageName": true,
    "involvement": true,
    "reports": true
}  

Report Submission

Description:
The user will be able to submit and store a report for later use. Each report may contain 0 or more attached profiles. If the profile does not have an assigned id, the server will generate one for it. This also goes for the report id. As always submit the required identification fields, as well as any pertinent data to the report.

PATH:
api/v1/reports/save_report

METHOD:
POST


BODY: 
{
    "token": "dd57715b2d0b0eb216df128a115edcb887dfd4d6ca5deb647b70c9e143076249",
    "accountId": {
        "accountIdString": "94112ff4-b3da-4a5a-b5c0-3df11edd2efa",
        "email": "someEmail",
        "businessId": 100
    },
    "profileList": [
            {   
                "profileId": {
                    "businessId": 100,
                    "profileId": null
                },
                "name": "JD, Jospeh Dante",
                "status": "guest concern",
                "address": {
                    "street1": "Bulldog Ln",
                    "street2": "Not that street",
                    "city": "Fresno",
                    "state": "CA",
                    "zipCode": 93726
                },
                "banDuration": {
                    "start": "2022-04-18",
                    "end": "2022-05-18"
                },
                "attributes": {
                    "dob": "2022-04-18",
                    "ageRange": "30-40",
                    "sex": "Male",
                    "eyeColor": "black",
                    "hairColor": "Bald",
                    "height": "Why Do you Need to Know?",
                    "weight": 160,
                    "race": "Daytona 500"
                },
                "imageName": "something.png",
                "involvement": "suspect",
                "reports": [
                   
                ],
                "businessId": 100,
                "profileIdString": null
            }
    ],
    "report":{
        "reportId": {
            "businessId": 100,
            "reportId": null
        },
        "date": "2022-06-17T23:44:02.686+00:00",
        "time": "19:33",
        "author": "FirstName LastName",
        "type": "shortage",
        "box1": "They did a very bad horrible thing!",
        "box2": "Footage shows this!",
        "box3": "none",
        "box4": "",
        "box5": "",
        "changeLog": []
    }
}

RESPONSE:
{
    "reportId": {
        "businessId": 100,
        "reportId": "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
    },
    "profiles": [
        {
            "profileId": {
                "businessId": 100,
                "profileId": "50a10ae5-de94-4e03-a6d3-6d42e882d848"
            },
            "name": "JD, Jospeh Dante",
            "status": "guest concern",
            "address": {
                "street1": "Bulldog Ln",
                "street2": "Not that street",
                "city": "Fresno",
                "state": "CA",
                "zipCode": 93726
            },
            "banDuration": {
                "start": "2022-04-18T00:00:00.000+00:00",
                "end": "2022-05-18T00:00:00.000+00:00"
            },
            "attributes": {
                "dob": "2022-04-18T00:00:00.000+00:00",
                "ageRange": "30-40",
                "sex": "Male",
                "eyeColor": "black",
                "hairColor": "Bald",
                "height": "Why Do you Need to Know?",
                "weight": 160,
                "race": "Daytona 500"
            },
            "imageName": "something.png",
            "involvement": "suspect",
            "reports": [
                "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
            ],
            "businessId": 100,
            "profileIdString": "50a10ae5-de94-4e03-a6d3-6d42e882d848"
        }
    ],
    "date": "2022-06-17T23:44:02.686+00:00",
    "time": "19:33",
    "author": "FirstName LastName",
    "type": "shortage",
    "box1": "They did a very bad horrible thing!",
    "box2": "Footage shows this!",
    "box3": "none",
    "box4": "",
    "box5": "",
    "changeLog": [
        "Timestamp: 2022-04-28 22:16:20.6059765, Author: FirstName LastName"
    ],
    "businessId": 100,
    "reportIdString": "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
}

Report Edits

Description:
When new information comes to light, a user may update a report

PATH:
api/v1/reports/update_report

METHOD:
PUT

BODY: 
{
    "token": "dd57715b2d0b0eb216df128a115edcb887dfd4d6ca5deb647b70c9e143076249",
    "accountId": {
        "accountIdString": "94112ff4-b3da-4a5a-b5c0-3df11edd2efa",
        "email": "someEmail",
        "businessId": 100
    },
    "profileList": [
            {   
                "profileId": {
                    "businessId": 100,
                    "profileId": "50a10ae5-de94-4e03-a6d3-6d42e882d848"
                },
                "name": "JD, Jospeh Dante",
                "status": "guest concern",
                "address": {
                    "street1": "Bulldog Ln",
                    "street2": "Not that street",
                    "city": "Fresno",
                    "state": "CA",
                    "zipCode": 93726
                },
                "banDuration": {
                    "start": "2022-04-18",
                    "end": "2022-05-18"
                },
                "attributes": {
                    "dob": "2022-04-18",
                    "ageRange": "30-40",
                    "sex": "Male",
                    "eyeColor": "black",
                    "hairColor": "Bald",
                    "height": "Why Do you Need to Know?",
                    "weight": 160,
                    "race": "Daytona 500"
                },
                "imageName": "something.png",
                "involvement": "suspect",
                "reports": [
                   "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
                ],
                "businessId": 100,
                "profileIdString": "50a10ae5-de94-4e03-a6d3-6d42e882d848"
            }
    ],
    "report":{
        "reportId": {
            "businessId": 100,
            "reportId": "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
        },
        "date": "2022-06-17T23:44:02.686+00:00",
        "time": "19:33",
        "author": "FirstName LastName",
        "type": "shortage",
        "box1": "They did a very bad horrible thing!",
        "box2": "Footage shows this!",
        "box3": "none",
        "box4": "",
        "box5": "",
        "changeLog": ["Foo changed this at 14:33 on 4-31-22"]
    }
}

RESPONSE:
{
    "reportId": {
        "businessId": 100,
        "reportId": "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
    },
    "profiles": [
        {
            "profileId": {
                "businessId": 100,
                "profileId": "50a10ae5-de94-4e03-a6d3-6d42e882d848"
            },
            "name": "JD, Jospeh Dante",
            "status": "guest concern",
            "address": {
                "street1": "Bulldog Ln",
                "street2": "Not that street",
                "city": "Fresno",
                "state": "CA",
                "zipCode": 93726
            },
            "banDuration": {
                "start": "2022-04-18T00:00:00.000+00:00",
                "end": "2022-05-18T00:00:00.000+00:00"
            },
            "attributes": {
                "dob": "2022-04-18T00:00:00.000+00:00",
                "ageRange": "30-40",
                "sex": "Male",
                "eyeColor": "black",
                "hairColor": "Bald",
                "height": "Why Do you Need to Know?",
                "weight": 160,
                "race": "Daytona 500"
            },
            "imageName": "something.png",
            "involvement": "suspect",
            "reports": [
                "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
            ],
            "businessId": 100,
            "profileIdString": "50a10ae5-de94-4e03-a6d3-6d42e882d848"
        }
    ],
    "date": "2022-06-17T23:44:02.686+00:00",
    "time": "19:33",
    "author": "FirstName LastName",
    "type": "shortage",
    "box1": "They did a very bad horrible thing!",
    "box2": "Footage shows this!",
    "box3": "none",
    "box4": "",
    "box5": "",
    "changeLog": [
        "Foo changed this at 14:33 on 4-31-22",
        "Timestamp: 2022-04-28 22:16:20.6059765, Author: FirstName LastName"
    ],
    "businessId": 100,
    "reportIdString": "7f2ec088-e089-4927-84e0-9e5b87dfe9b3"
}

Mass Report Retrieval

Description: In general, when a user logs in, they will be presented with a list of the Most Recent reports. After some time, a business will generally have several reports, and thus the output is separated into pages. Some additional fields are required, i.e. Page Number (starting at 0), Page size, and Sort Properties. Sort properties sort by a given key value, and order by ASC or DESC.

NOTE Result filtering based on property is planned and will be implemented at a later date

PATH:
api/v1/reports/get_reports   
  
METHOD: 
POST
  
BODY:  
{
    "token": "87a06f03946c8c20fc92163af9517d9ef71e0046696b7823579f3ef12e94e96a",
    "accountId": {
        "accountIdString": "3960ab55-a7ad-46dd-998f-0f13c7316caf",
        "email": "someEmail",
        "businessId": 100
    },
    "page": 1,
    "size": 2,
    "sort": null,
    "sortProperties": {
        "date": "ASC"
    }
    
}  
  
RESPONSE:  
  
{
    "content": [
        {
            "reportId": {
                "businessId": 100,
                "reportId": "bd79436d-a36a-4184-9b9e-975b8b337f75"
            },
            "profiles": [
                {
                    "profileId": {
                        "businessId": 100,
                        "profileId": "da6db9e9-1ecc-4ea7-a25f-09481d707d58"
                    },
                    "street1": "Not this street",
                    "street2": "Not that street",
                    "city": "Fresno",
                    "state": "CA",
                    "zipCode": 93777
                    "reports": [
                        "bd79436d-a36a-4184-9b9e-975b8b337f75"
                    ],
                    "profileIdString": "da6db9e9-1ecc-4ea7-a25f-09481d707d58",
                    "businessId": 100
                }
            ],
            "date": "2022-05-13T23:44:02.686+00:00",
            "time": "14:33",
            "author": "FirstName LastName",
            "type": "shortage",
            "box1": "They did a very bad horrible thing!",
            "box2": "Footage shows this!",
            "box3": "none",
            "box4": "",
            "box5": "",
            "changeLog": [
                "Foo changed this at 14:33 on 4-31-22"
            ],
            "reportIdString": "bd79436d-a36a-4184-9b9e-975b8b337f75",
            "businessId": 100
        },
        {
            "reportId": {
                "businessId": 100,
                "reportId": "011384d7-5a9a-4304-94b0-37322d46d0bc"
            },
            "profiles": [
                {
                    "profileId": {
                        "businessId": 100,
                        "profileId": "2cbb4033-7037-418d-9cfe-f7e006210d9d"
                    },
                    "street1": "Not this street",
                    "street2": "Not that street",
                    "city": "Fresno",
                    "state": "CA",
                    "zipCode": 93777
                    "reports": [
                        "011384d7-5a9a-4304-94b0-37322d46d0bc"
                    ],
                    "profileIdString": "2cbb4033-7037-418d-9cfe-f7e006210d9d",
                    "businessId": 100
                }
            ],
            "date": "2022-06-13T23:44:02.686+00:00",
            "time": "14:33",
            "author": "FirstName LastName",
            "type": "shortage",
            "box1": "They did a very bad horrible thing!",
            "box2": "Footage shows this!",
            "box3": "none",
            "box4": "",
            "box5": "",
            "changeLog": [
                "Foo changed this at 14:33 on 4-31-22"
            ],
            "reportIdString": "011384d7-5a9a-4304-94b0-37322d46d0bc",
            "businessId": 100
        }
    ],
    "pageable": {
        "sort": {
            "empty": false,
            "sorted": true,
            "unsorted": false
        },
        "offset": 2,
        "pageSize": 2,
        "pageNumber": 1,
        "unpaged": false,
        "paged": true
    },
    "totalPages": 2,
    "totalElements": 4,
    "last": true,
    "size": 2,
    "number": 1,
    "sort": {
        "empty": false,
        "sorted": true,
        "unsorted": false
    },
    "numberOfElements": 2,
    "first": false,
    "empty": false
}     

Profile Edits

Description:
Users can update a profiles information when new information comes to light, or when the format changes and thus new information
is needed.

PATH: 
api/v1/reports/update_profile 
 
METHOD:
PUT

BODY:
{
    "token": "b57162fd595fe8f41f514458d507d738f23197645b952c78180e9f0cdb67e9d0",
    "accountId": {
        "accountIdString": "215c3285-3f0f-4173-8f44-b5fe10a6d918",
        "email": "someEmail",
        "businessId": 100
    },
    "profile": {
        "profileId": {
                "businessId": 100,
                "profileId": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
            },
        "name": "JD, Jospeh Dante",
        "status": "guest concern",
        "address": {
            "street1": "Bulldog Ln",
            "street2": "Not that street",
            "city": "Fresno",
            "state": "CA",
            "zipCode": 93726
        },
        "banDuration": {
            "start": "2022-04-19",
            "end": "2022-05-19"
        },
        "attributes": {
            "dob": "2022-04-19",
            "ageRange": "30-40",
            "sex": "Male",
            "eyeColor": "black",
            "hairColor": "Bald",
            "height": "Why Do you Need to Know?",
            "weight": 160,
            "race": "Daytona 500"
        },
        "imageName": "something.png",
        "involvement": null,
        "reports": [
            "9f5a321b-07d7-4af4-98a3-82a4f4477dad"
        ],
        "businessId": 100,
        "profileIdString": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
    }
}

RESPONSE:  
{
    "profileId": {
        "businessId": 100,
        "profileId": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
    },
    "name": "JD, Jospeh Dante",
    "status": "guest concern",
    "address": {
        "street1": "Bulldog Ln",
        "street2": "Not that street",
        "city": "Fresno",
        "state": "CA",
        "zipCode": 93726
    },
    "banDuration": {
        "start": "2022-04-19T00:00:00.000+00:00",
        "end": "2022-05-19T00:00:00.000+00:00"
    },
    "attributes": {
        "dob": "2022-04-19T00:00:00.000+00:00",
        "ageRange": "30-40",
        "sex": "Male",
        "eyeColor": "black",
        "hairColor": "Bald",
        "height": "Why Do you Need to Know?",
        "weight": 160,
        "race": "Daytona 500"
    },
    "imageName": "something.png",
    "involvement": null,
    "reports": [
        "9f5a321b-07d7-4af4-98a3-82a4f4477dad"
    ],
    "businessId": 100,
    "profileIdString": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
}

Profile Retrieval

Description:
Users should be able to retrieve complete profile information from any of the profiles related to their given business account. This method allows for retrieval of a single profile by use of a profile_id

PATH:
api/v1/reports/get_profile/{profile_id}  // {profile_id} is to be replaced by the actual id

EXAMPLE PATH:
/api/v1/reports/get_profile/bd4b4e84-3ba5-4837-b544-7da8c77ed0dc  
  
METHOD:
POST

BODY:
{
    "token": "af4a16052fb5c923f4d5e38bb5ee7aeec91944b40840aaf5857372cabd2f6d1b",
    "accountId": {
        "accountIdString": "215c3285-3f0f-4173-8f44-b5fe10a6d918",
        "email": "someEmail",
        "businessId": 100
    }
}  
  
RESPONSE: 
{
    "profileId": {
        "businessId": 100,
        "profileId": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
    },
    "name": "Weak Sauce",
    "status": "banned",
    "address": {
        "street1": "Not this street",
        "street2": "Not that street",
        "city": "Fresno",
        "state": "CA",
        "zipCode": 93777
    },
    "banDuration": {
        "start": "2022-04-19",
        "end": "2022-05-19"
    },
    "attributes": {
        "dob": "2022-04-19",
        "ageRange": "30-40",
        "sex": "please",
        "eyeColor": "black",
        "hairColor": "Bald",
        "height": "Why Do you Need to Know?",
        "weight": 160,
        "race": "Daytona 500"
    },
    "imageName": "something.png",
    "involvement": null,
    "reports": [
        "9f5a321b-07d7-4af4-98a3-82a4f4477dad"
    ],
    "businessId": 100,
    "profileIdString": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
}

Mass Profile Retrieval

Description:
When a user doesn't have a specific account to retrieve, and instead wants any number of them they can use this service.
NOTE: Pagination is not currently enabled, but is planned

PATH:
/api/v1/reports/get_profiles  
  
METHOD:
POST


BODY:  
{
    "token": "af4a16052fb5c923f4d5e38bb5ee7aeec91944b40840aaf5857372cabd2f6d1b",
    "accountId": {
        "accountIdString": "215c3285-3f0f-4173-8f44-b5fe10a6d918",
        "email": "someEmail",
        "businessId": 100
    }
}  
  
RESPONSE:  
{
    "content": [
        {
            "profileId": {
                "businessId": 100,
                "profileId": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
            },
            "name": "Weak Sauce",
            "status": "banned",
            "address": {
                "street1": "Not this street",
                "street2": "Not that street",
                "city": "Fresno",
                "state": "CA",
                "zipCode": 93777
            },
            "banDuration": {
                "start": "2022-04-19",
                "end": "2022-05-19"
            },
            "attributes": {
                "dob": "2022-04-19",
                "ageRange": "30-40",
                "sex": "please",
                "eyeColor": "black",
                "hairColor": "Bald",
                "height": "Why Do you Need to Know?",
                "weight": 160,
                "race": "Daytona 500"
            },
            "imageName": "something.png",
            "involvement": null,
            "reports": [
                "9f5a321b-07d7-4af4-98a3-82a4f4477dad"
            ],
            "businessId": 100,
            "profileIdString": "bd4b4e84-3ba5-4837-b544-7da8c77ed0dc"
        }
    ],
    "pageable": {
        "sort": {
            "empty": false,
            "sorted": true,
            "unsorted": false
        },
        "offset": 0,
        "pageSize": 20,
        "pageNumber": 0,
        "paged": true,
        "unpaged": false
    },
    "totalPages": 1,
    "totalElements": 1,
    "last": true,
    "size": 20,
    "number": 0,
    "sort": {
        "empty": false,
        "sorted": true,
        "unsorted": false
    },
    "numberOfElements": 1,
    "first": true,
    "empty": false
}

Images

Save Image

Description:
Saving Images is handled separately from the other profile functions. This is due to the nature of the facial recognition program. The images will be stored in the same local machine that the facial recognition program is ran from. To provide more information with the image, it must be converted to a base64 encoded string. To allow json serialization, it is recommended to also encode it in UTF-8. The other information fields are used to index the image in the 'Image' database.

PATH:  
/save_image
  
METHOD:  
POST 
  
BODY:  
{  
  "image": base64_string_UTF-8_Encoded,
  "profile_id": "someId", 
  "business_id": some_business_id,
  "file_name": "suspect_image1.png"
}  
  
RESPONSE:
HTTP 200 OK  

Get Image

Description: To display an image on the front end, the user will need to be able to retrieve an image from the image server. All that is needed to retrieve the image is the respective business_id and profile_id that was submitted with the image initially.
NOTE: Due to last second development, the auth requirements were forgone and thus a token and accountId are not needed for interaction with this server.

PATH:  
/get_image/<business_id>/<profile_id>
  
METHOD:  
GET
  
BODY:  
  
RESPONSE:
IMAGE