Skip to content

Endpoints

Ivan Zhang edited this page Oct 25, 2023 · 4 revisions

Rest API Documentation

User Management

Get All Users

Endpoint: /users

Method: GET

Description: Fetch all users.

Input: None

Output: List of user details.


Add a New User

Endpoint: /user

Method: POST

Description: Add a new user.

Input:

  • person: Object containing user details (name, email).

Output: Confirmation of success.


Remove a User

Endpoint: /user

Method: DELETE

Description: Remove a user based on their email.

Input:

  • email: Email of the user to be removed.

Output: Confirmation of success.


Patrol Management

Get Patrol Details and All Its Runs

Endpoint: /patrol/{patrol_id}/run/{run_id}

Method: GET

Description: Fetch details of a specific patrol and all of its runs.

Input:

  • patrol_id: ID of the patrol.
  • run_id: ID of the run.

Output: Details of the patrol, its settings, all runs, and details of the latest run of this patrol.


Create a New Patrol Run

Endpoint: /patrol/run

Method: POST

Description: Create a new patrol run.

Input:

  • patrol_run: Object containing details for creating a new patrol run
    • patrol_group: Name of the patrol group.
    • patrol: Name of the patrol.
    • status: Status of the patrol run.
    • severity: Severity of the patrol run.
    • start_time: Start time of the patrol run.
    • end_time: End time of the patrol run.
    • patrol_code: Code of the patrol.
    • logs: Logs for the patrol run.
    • return_value: Return value of the patrol run.
    • exception: Exception of the patrol run.

Output: Confirmation of success.


Resolve a Patrol Run

Endpoint: /patrol/{patrol_id}/run/{run_id}/resolve

Method: POST

Description: Mark a specific patrol run as resolved.

Input:

  • patrol_id: ID of the patrol.
  • run_id: ID of the run.

Output: Confirmation of success.


Get All Patrol Groups

Endpoint: /patrol_groups

Method: GET

Description: Fetch all patrol groups.

Input: None

Output: List of all patrol groups and the number of successes and failures with respect to the latest patrol runs


Get Patrol Group Information

Endpoint: /patrol_group/{group_name}

Method: GET

Description: Fetch details of a specific patrol group, including the latest run of each patrol in the group.

Input:

  • group_name: Name of the patrol group.

Output: Details of the patrol group, list of successful patrols, list of failed patrols, and IDs of all patrols.


Delete a Patrol Group

Endpoint: /patrol_group/{group_id}

Method: DELETE

Description: Remove a patrol group and its associated patrols and runs.

Input:

  • group_id: ID of the patrol group.

Output: Confirmation of success.


Get a Patrol and All Its Runs

Endpoint: /patrol/{patrol_id}

Method: GET

Description: Fetch details of a specific patrol and all of its runs.

Input:

  • patrol_id: ID of the patrol.

Output: Details of the patrol, its settings, and all its runs.


Delete a Patrol

Endpoint: /patrol/{patrol_id}

Method: DELETE

Description: Remove a specific patrol.

Input:

  • patrol_id: ID of the patrol.

Output: Confirmation of success.


Get Summary of All Latest Patrol Runs

Endpoint: /summary

Method: GET

Description: Fetch a summary of all the latest patrol runs.

Input: None

Output: Summary details of all the latest patrol runs.


Parameter Management

Get Patrol Parameters

Endpoint: /patrol_parameters/{patrol_group}/{patrol}

Method: GET

Description: Fetch all parameters for a specific patrol within a patrol group.

Input:

  • patrol_group: Id of the patrol group.
  • patrol: Id of the patrol.

Output: List of all parameters for the specified patrol.


Delete a Patrol Parameter

Endpoint: /patrol_parameters/{parameter_id}

Method: DELETE

Description: Remove a specific patrol parameter.

Input:

  • parameter_id: ID of the parameter.

Output: Confirmation of success.


Get Value for a Patrol Parameter

Endpoint: /patrol_parameters/{patrol_group}/{patrol}/{type}/{parameter_id}

Method: GET

Description: Fetch value for a specific parameter within a patrol and patrol group.

Input:

  • patrol_group: Name of the patrol group.
  • patrol: Name of the patrol.
  • type: Type of the parameter.
  • parameter_id: ID of the parameter.

Output: Value of the specified parameter.


Update Patrol Parameters

Endpoint: /patrol_parameters

Method: POST

Description: Update or create patrol parameters.

Input:

  • patrol_params: Object containing details to update or create patrol parameters.
    • patrol_group: Name of the patrol group.
    • patrol: Name of the patrol.
    • parameter_id: ID of the parameter.
    • value: Value of the parameter.
    • type: Type of the parameter.
    • is_active: Whether the parameter is active or not.

Output: Confirmation of success.


Reset All Parameters for a Patrol

Endpoint: /reset_parameters

Method: POST

Description: Set all parameters to inactive for a specific patrol within a patrol group.

Input:

  • request: Object containing details to reset parameters.
    • patrol_group: Name of the patrol group.
    • patrol: Name of the patrol.

Output: Confirmation of success.


Settings Management

Get Patrol Settings

Endpoint: /patrol_settings/{patrol}

Method: GET

Description: Fetch settings for a specific patrol.

Input:

  • patrol: Id of the patrol.

Output: Settings for the specified patrol.


Get Patrol Settings

Endpoint: /patrol_settings/{patrol_group}/{patrol}

Method: GET

Description: Fetch settings for a specific patrol within a patrol group.

Input:

  • patrol_group: Name of the patrol group.
  • patrol: Name of the patrol.

Output: Settings for the specified patrol.


Update Patrol Settings

Endpoint: /patrol_settings

Method: POST

Description: Update or create patrol settings.

Input:

  • request: Object containing details to update or create patrol settings.
    • patrol_group: Id of the patrol group.
    • patrol: Id of the patrol.
    • assigned_to_person (optional): ID of the person assigned to the patrol.
    • alerting: Whether the patrol is alerting or not.
    • silenced_until (optional): Time until the patrol is silenced.

Output: Confirmation of success.


Profile Management

Get Stored Data Profile

Endpoint: /profile/{profile_id}

Method: GET

Description: Retrieve a stored data profile by its ID.

Input:

  • profile_id: ID of the profile to retrieve.

Output: A data profile object containing details such as patrol group, patrol, report, time, and format. If the profile is not found, a 404 error with a "Profile not found." detail is returned.


Store a Data Profile

Endpoint: /profile

Method: POST

Description: Store a new data profile.

Input:

  • request: Object containing details to store a new data profile.
    • patrol_group: Name of the patrol group.
    • patrol: Name of the patrol.
    • report: Report associated with the patrol.
    • time: Time associated with the patrol report.
    • format: Format of the report.

Output: Confirmation of success.