FreshPy Core Object¶
This section provides details around the core module and the methods used within the core object for the freshpy package, which are listed below.
Init Module (freshpy)¶
This module (being the primary __init__.py file for the library) provides a
“jumping-off-point” to initialize the primary freshpy.core.FreshPy object.
- Package:
freshpy
- Synopsis:
This is the
__init__module for the freshpy package- Created By:
Jeff Shurtliff
- Last Modified:
Jeff Shurtliff
- Modified Date:
02 Jan 2026
- class freshpy.FreshPy(domain=None, api_key=None, env_variables=None, verify_ssl=None)[source]¶
This is the class for the core object leveraged in this library.
- class Agents(freshpy_object)[source]¶
This class includes methods associated with Freshservice agents.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Ticketsinner class object.Added in version 2.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_agent_group(group_id, verify_ssl=None)[source]¶
This method returns data for a specific agent group.
Added in version 3.0.0.
- Parameters:
- Returns:
A JSON-formatted dictionary with the agent group data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_agent_id(email, verify_ssl=None)[source]¶
This method retrieves the Agent ID value for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
- Returns:
The Agent ID of the agent as an integer
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.NotFoundResponseError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- get_agent_role(role_id, verify_ssl=None)[source]¶
This method returns data for a specific agent role.
Added in version 3.0.0.
- Parameters:
- Returns:
A JSON-formatted dictionary with the agent role data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agent_groups(verify_ssl=None)[source]¶
This method returns data for all agent groups.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
A JSON-formatted dictionary with the agent group data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agent_roles(verify_ssl=None)[source]¶
This method returns data for all agent roles.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
A JSON-formatted dictionary with the agent role data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agents(only_active=None, only_inactive=None, verify_ssl=None)[source]¶
This method returns data for all agents with an optional filters for active or inactive users.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
- Returns:
JSON data with user data for all agents
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_assignment_history(lookup_value, verify_ssl=None)[source]¶
This method retrieves the user assignment history for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
lookup_value – An Agent ID or email address with which to look up the user
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Tyype lookup_value:
str, int
- Returns:
JSON data for the assignment history for the agent
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.NotFoundResponseError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- get_user_info(lookup_value, verify_ssl=None)[source]¶
This method retrieves user data for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
lookup_value – An Agent ID or email address with which to look up the user
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Tyype lookup_value:
str, int
- Returns:
JSON data with the agent user data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- class Objects(freshpy_object)[source]¶
This class includes methods associated with Freshservice custom objects.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Objectsinner class object.Added in version 3.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_all_custom_objects(workspace_id=None, verify_ssl=True)[source]¶
This method retrieves the custom objects associated with a Freshservice instance.
Added in version 3.0.0.
- Parameters:
- Returns:
Dictionary (JSON) with the custom object data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_custom_object(object_id, verify_ssl=None)[source]¶
This method retrieves a specific custom object.
Added in version 3.0.0.
:param verify_ssl:Determines if SSL verification should occur (
Trueby default) :type verify_ssl: bool :returns: Dictionary (JSON) with the custom object data :raises:freshpy.errors.exceptions.APIConnectionError,
- class Tickets(freshpy_object)[source]¶
This class includes methods associated with Freshservice tickets.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Ticketsinner class object.Added in version 1.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_ticket(ticket_number, include=None, verify_ssl=None)[source]¶
This method returns the data for a specific ticket.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 2.0.0: Updated the function call to use keyword arguments.
Changed in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
- Returns:
JSON data for the given ticket
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_ticket_field(field_id=None, field_label=None, field_name=None, match_case=True, ticket_data=None, workspace_id=None, verify_ssl=None)[source]¶
This method retrieves a specific ticket field based on a provided ID, Label, and/or Name.
Added in version 3.0.0.
- Parameters:
field_label (str, None) – The
labelvalue for the fieldfield_name (str, None) – The
namevalue for the fieldmatch_case (bool) – Determines if the
labelvalue should be case-sensitive (Trueby default)ticket_data (dict, list, None) – Dictionary or list containing all ticket field data (optional)
workspace_id (str, int, None) – The ID of a specific workspace (defaults to primary workspace if not specified)
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
A JSON-formatted dictionary with the field data (or an empty dictionary if the field is not found)
- Raises:
freshpy.errors.exceptions.InvalidPredefinedFilterError,freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_ticket_fields(workspace_id=None, verify_ssl=None)[source]¶
This method retrieves the standard and custom fields that exist for tickets.
Added in version 3.0.0.
- Parameters:
- Returns:
Dictionary (JSON) with the ticket field data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_tickets(include=None, predefined_filter=None, filters=None, filter_logic='AND', requester_id=None, requester_email=None, ticket_type=None, updated_since=None, ascending=None, descending=None, per_page=None, page=None, verify_ssl=None)[source]¶
This method returns a sequence of tickets with optional filters.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
include (str, tuple, list, set, None) –
A string or iterable of embedding options
predefined_filter (str, None) – One of the predefined filters (‘new_and_my_open’, ‘watching’, ‘spam’, ‘deleted’)
filters (str, dict, None) – Query filter(s) in the form of a structured query string or a dictionary of values
filter_logic – Defines the logic to use as necessary in a filter query string (default is
AND)requester_id (str, int, None) – The numeric ID of a requester
requester_id – The numeric ID of a requester
requester_email (str, None) – The email address of a requester
ticket_type (str, None) – The type of ticket (e.g.
Incident,Service Request, etc.)updated_since (str, None) – A threshold date or timestamp (in UTC format) for when the ticket was last updated
ascending (bool, None) – Determines if the tickets should be sorted in ascending order
descending (bool, None) – Determines if the tickets should be sorted in descending order (default)
per_page (str, int, None) – Displays a certain number of results per query
page (str, int, None) – Returns a specific page number (used for paginated results)
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
A list of JSON objects for tickets
- Raises:
freshpy.errors.exceptions.InvalidPredefinedFilterError,freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- class Workspaces(freshpy_object)[source]¶
This class includes methods associated with Freshservice workspaces/clients.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Workspacesinner class object.Added in version 3.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_all_workspaces(verify_ssl=None)[source]¶
This method returns data on all workspaces.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
Dictionary (JSON) with the workspace data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- __init__(domain=None, api_key=None, env_variables=None, verify_ssl=None)[source]¶
This method instantiates the core FreshPy object.
Changed in version 3.0.0: Made multiple improvements to the object class and methods. (See changelog for full details)
Added in version 1.0.0.
- get(uri, headers=None, params=None, return_json=True, timeout=30, verify_ssl=None)[source]¶
This method performs a GET request against the Freshservice API with multiple retries on failure.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
uri (string) – The URI to query
headers (dict, None) – The HTTP headers to utilize in the REST API call
params (dict, None) – The query parameters (where applicable)
return_json (bool) – Determines if JSON data should be returned
timeout (int, str, None) – The timeout period in seconds (defaults to
30)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The JSON data from the response or the raw
requestsresponse.- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- patch(uri, payload, params=None, headers=None, timeout=30, show_full_error=True, return_json=True, verify_ssl=None)[source]¶
This method performs a PATCH call that includes a JSON-formatted payload.
Added in version 3.0.0.
- Parameters:
uri (str) – The API endpoint to query
payload (dict) – The payload to leverage in the API call
params (dict, None) – The query parameters (where applicable)
headers (dict, None) – Specific API headers to use when performing the API call
timeout (int, str, None) – The timeout period in seconds (defaults to
30)show_full_error (bool) – Determines if the full error message should be displayed (
Trueby default)return_json – Determines if the response should be returned in JSON format (
Trueby default)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The API response in JSON format or as a
requestsresponse object- Raises:
freshpy.errors.exceptions.PATCHRequestError,freshpy.errors.exceptions.APIRequestError,freshpy.errors.exceptions.APIConnectionError
- post(uri, payload, params=None, headers=None, timeout=30, show_full_error=True, return_json=True, verify_ssl=None)[source]¶
This method performs a POST call that includes a JSON-formatted payload.
Added in version 3.0.0.
- Parameters:
uri (str) – The API endpoint to query
payload (dict) – The payload to leverage in the API call
params (dict, None) – The query parameters (where applicable)
headers (dict, None) – Specific API headers to use when performing the API call
timeout (int, str, None) – The timeout period in seconds (defaults to
30)show_full_error (bool) – Determines if the full error message should be displayed (
Trueby default)return_json – Determines if the response should be returned in JSON format (
Trueby default)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The API response in JSON format or as a
requestsresponse object- Raises:
freshpy.errors.exceptions.POSTRequestError,freshpy.errors.exceptions.APIRequestError,freshpy.errors.exceptions.APIConnectionError
- put(uri, payload, params=None, headers=None, timeout=30, show_full_error=True, return_json=True, verify_ssl=None)[source]¶
This method performs a PUT call that includes a JSON-formatted payload.
Added in version 3.0.0.
- Parameters:
uri (str) – The API endpoint to query
payload (dict) – The payload to leverage in the API call
params (dict, None) – The query parameters (where applicable)
headers (dict, None) – Specific API headers to use when performing the API call
timeout (int, str, None) – The timeout period in seconds (defaults to
30)show_full_error (bool) – Determines if the full error message should be displayed (
Trueby default)return_json – Determines if the response should be returned in JSON format (
Trueby default)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The API response in JSON format or as a
requestsresponse object- Raises:
freshpy.errors.exceptions.PUTRequestError,freshpy.errors.exceptions.APIRequestError,freshpy.errors.exceptions.APIConnectionError
Core Module (freshpy.core)¶
This module contains the core object and functions to establish the connection to the API and leverage it to perform various actions.
- Module:
freshpy.core
- Synopsis:
Defines the core freshpy object used to interface with the Freshservice API
- Created By:
Jeff Shurtliff
- Last Modified:
Jeff Shurtliff
- Modified Date:
03 Dec 2026
- class freshpy.core.FreshPy(domain=None, api_key=None, env_variables=None, verify_ssl=None)[source]¶
This is the class for the core object leveraged in this library.
- class Agents(freshpy_object)[source]¶
This class includes methods associated with Freshservice agents.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Ticketsinner class object.Added in version 2.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_agent_group(group_id, verify_ssl=None)[source]¶
This method returns data for a specific agent group.
Added in version 3.0.0.
- Parameters:
- Returns:
A JSON-formatted dictionary with the agent group data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_agent_id(email, verify_ssl=None)[source]¶
This method retrieves the Agent ID value for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
- Returns:
The Agent ID of the agent as an integer
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.NotFoundResponseError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- get_agent_role(role_id, verify_ssl=None)[source]¶
This method returns data for a specific agent role.
Added in version 3.0.0.
- Parameters:
- Returns:
A JSON-formatted dictionary with the agent role data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agent_groups(verify_ssl=None)[source]¶
This method returns data for all agent groups.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
A JSON-formatted dictionary with the agent group data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agent_roles(verify_ssl=None)[source]¶
This method returns data for all agent roles.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
A JSON-formatted dictionary with the agent role data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agents(only_active=None, only_inactive=None, verify_ssl=None)[source]¶
This method returns data for all agents with an optional filters for active or inactive users.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
- Returns:
JSON data with user data for all agents
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_assignment_history(lookup_value, verify_ssl=None)[source]¶
This method retrieves the user assignment history for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
lookup_value – An Agent ID or email address with which to look up the user
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Tyype lookup_value:
str, int
- Returns:
JSON data for the assignment history for the agent
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.NotFoundResponseError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- get_user_info(lookup_value, verify_ssl=None)[source]¶
This method retrieves user data for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
lookup_value – An Agent ID or email address with which to look up the user
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Tyype lookup_value:
str, int
- Returns:
JSON data with the agent user data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- class Objects(freshpy_object)[source]¶
This class includes methods associated with Freshservice custom objects.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Objectsinner class object.Added in version 3.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_all_custom_objects(workspace_id=None, verify_ssl=True)[source]¶
This method retrieves the custom objects associated with a Freshservice instance.
Added in version 3.0.0.
- Parameters:
- Returns:
Dictionary (JSON) with the custom object data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_custom_object(object_id, verify_ssl=None)[source]¶
This method retrieves a specific custom object.
Added in version 3.0.0.
:param verify_ssl:Determines if SSL verification should occur (
Trueby default) :type verify_ssl: bool :returns: Dictionary (JSON) with the custom object data :raises:freshpy.errors.exceptions.APIConnectionError,
- class Tickets(freshpy_object)[source]¶
This class includes methods associated with Freshservice tickets.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Ticketsinner class object.Added in version 1.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_ticket(ticket_number, include=None, verify_ssl=None)[source]¶
This method returns the data for a specific ticket.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 2.0.0: Updated the function call to use keyword arguments.
Changed in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
- Returns:
JSON data for the given ticket
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_ticket_field(field_id=None, field_label=None, field_name=None, match_case=True, ticket_data=None, workspace_id=None, verify_ssl=None)[source]¶
This method retrieves a specific ticket field based on a provided ID, Label, and/or Name.
Added in version 3.0.0.
- Parameters:
field_label (str, None) – The
labelvalue for the fieldfield_name (str, None) – The
namevalue for the fieldmatch_case (bool) – Determines if the
labelvalue should be case-sensitive (Trueby default)ticket_data (dict, list, None) – Dictionary or list containing all ticket field data (optional)
workspace_id (str, int, None) – The ID of a specific workspace (defaults to primary workspace if not specified)
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
A JSON-formatted dictionary with the field data (or an empty dictionary if the field is not found)
- Raises:
freshpy.errors.exceptions.InvalidPredefinedFilterError,freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_ticket_fields(workspace_id=None, verify_ssl=None)[source]¶
This method retrieves the standard and custom fields that exist for tickets.
Added in version 3.0.0.
- Parameters:
- Returns:
Dictionary (JSON) with the ticket field data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_tickets(include=None, predefined_filter=None, filters=None, filter_logic='AND', requester_id=None, requester_email=None, ticket_type=None, updated_since=None, ascending=None, descending=None, per_page=None, page=None, verify_ssl=None)[source]¶
This method returns a sequence of tickets with optional filters.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
include (str, tuple, list, set, None) –
A string or iterable of embedding options
predefined_filter (str, None) – One of the predefined filters (‘new_and_my_open’, ‘watching’, ‘spam’, ‘deleted’)
filters (str, dict, None) – Query filter(s) in the form of a structured query string or a dictionary of values
filter_logic – Defines the logic to use as necessary in a filter query string (default is
AND)requester_id (str, int, None) – The numeric ID of a requester
requester_id – The numeric ID of a requester
requester_email (str, None) – The email address of a requester
ticket_type (str, None) – The type of ticket (e.g.
Incident,Service Request, etc.)updated_since (str, None) – A threshold date or timestamp (in UTC format) for when the ticket was last updated
ascending (bool, None) – Determines if the tickets should be sorted in ascending order
descending (bool, None) – Determines if the tickets should be sorted in descending order (default)
per_page (str, int, None) – Displays a certain number of results per query
page (str, int, None) – Returns a specific page number (used for paginated results)
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
A list of JSON objects for tickets
- Raises:
freshpy.errors.exceptions.InvalidPredefinedFilterError,freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- class Workspaces(freshpy_object)[source]¶
This class includes methods associated with Freshservice workspaces/clients.
- __init__(freshpy_object)[source]¶
This method initializes the
freshpy.core.freshpy.Workspacesinner class object.Added in version 3.0.0.
- Parameters:
freshpy_object (class[freshpy.FreshPy]) – The core
freshpy.FreshPyobject
- get_all_workspaces(verify_ssl=None)[source]¶
This method returns data on all workspaces.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
Dictionary (JSON) with the workspace data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- __init__(domain=None, api_key=None, env_variables=None, verify_ssl=None)[source]¶
This method instantiates the core FreshPy object.
Changed in version 3.0.0: Made multiple improvements to the object class and methods. (See changelog for full details)
Added in version 1.0.0.
- get(uri, headers=None, params=None, return_json=True, timeout=30, verify_ssl=None)[source]¶
This method performs a GET request against the Freshservice API with multiple retries on failure.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
uri (string) – The URI to query
headers (dict, None) – The HTTP headers to utilize in the REST API call
params (dict, None) – The query parameters (where applicable)
return_json (bool) – Determines if JSON data should be returned
timeout (int, str, None) – The timeout period in seconds (defaults to
30)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The JSON data from the response or the raw
requestsresponse.- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- patch(uri, payload, params=None, headers=None, timeout=30, show_full_error=True, return_json=True, verify_ssl=None)[source]¶
This method performs a PATCH call that includes a JSON-formatted payload.
Added in version 3.0.0.
- Parameters:
uri (str) – The API endpoint to query
payload (dict) – The payload to leverage in the API call
params (dict, None) – The query parameters (where applicable)
headers (dict, None) – Specific API headers to use when performing the API call
timeout (int, str, None) – The timeout period in seconds (defaults to
30)show_full_error (bool) – Determines if the full error message should be displayed (
Trueby default)return_json – Determines if the response should be returned in JSON format (
Trueby default)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The API response in JSON format or as a
requestsresponse object- Raises:
freshpy.errors.exceptions.PATCHRequestError,freshpy.errors.exceptions.APIRequestError,freshpy.errors.exceptions.APIConnectionError
- post(uri, payload, params=None, headers=None, timeout=30, show_full_error=True, return_json=True, verify_ssl=None)[source]¶
This method performs a POST call that includes a JSON-formatted payload.
Added in version 3.0.0.
- Parameters:
uri (str) – The API endpoint to query
payload (dict) – The payload to leverage in the API call
params (dict, None) – The query parameters (where applicable)
headers (dict, None) – Specific API headers to use when performing the API call
timeout (int, str, None) – The timeout period in seconds (defaults to
30)show_full_error (bool) – Determines if the full error message should be displayed (
Trueby default)return_json – Determines if the response should be returned in JSON format (
Trueby default)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The API response in JSON format or as a
requestsresponse object- Raises:
freshpy.errors.exceptions.POSTRequestError,freshpy.errors.exceptions.APIRequestError,freshpy.errors.exceptions.APIConnectionError
- put(uri, payload, params=None, headers=None, timeout=30, show_full_error=True, return_json=True, verify_ssl=None)[source]¶
This method performs a PUT call that includes a JSON-formatted payload.
Added in version 3.0.0.
- Parameters:
uri (str) – The API endpoint to query
payload (dict) – The payload to leverage in the API call
params (dict, None) – The query parameters (where applicable)
headers (dict, None) – Specific API headers to use when performing the API call
timeout (int, str, None) – The timeout period in seconds (defaults to
30)show_full_error (bool) – Determines if the full error message should be displayed (
Trueby default)return_json – Determines if the response should be returned in JSON format (
Trueby default)verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
The API response in JSON format or as a
requestsresponse object- Raises:
freshpy.errors.exceptions.PUTRequestError,freshpy.errors.exceptions.APIRequestError,freshpy.errors.exceptions.APIConnectionError
Core Functionality Subclasses (freshpy.core.FreshPy)¶
These classes below are inner/nested classes within the core freshpy.core.FreshPy class.
Note
The classes themselves are PascalCase format and singular (e.g. Node, Category, etc.) whereas
the names used to call the inner class methods are all lowercase (or snake_case) and plural.
(e.g. core_object.nodes.get_node_id(), core_object.categories.get_category_id(), etc.)
Agents Subclass (freshpy.core.FreshPy.Agents)¶
- class FreshPy.Agents(freshpy_object)[source]
This class includes methods associated with Freshservice agents.
- get_agent_group(group_id, verify_ssl=None)[source]
This method returns data for a specific agent group.
Added in version 3.0.0.
- Parameters:
- Returns:
A JSON-formatted dictionary with the agent group data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_agent_id(email, verify_ssl=None)[source]
This method retrieves the Agent ID value for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
- Returns:
The Agent ID of the agent as an integer
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.NotFoundResponseError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- get_agent_role(role_id, verify_ssl=None)[source]
This method returns data for a specific agent role.
Added in version 3.0.0.
- Parameters:
- Returns:
A JSON-formatted dictionary with the agent role data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agent_groups(verify_ssl=None)[source]
This method returns data for all agent groups.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
A JSON-formatted dictionary with the agent group data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agent_roles(verify_ssl=None)[source]
This method returns data for all agent roles.
Added in version 3.0.0.
- Parameters:
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)- Returns:
A JSON-formatted dictionary with the agent role data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_all_agents(only_active=None, only_inactive=None, verify_ssl=None)[source]
This method returns data for all agents with an optional filters for active or inactive users.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
- Returns:
JSON data with user data for all agents
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_assignment_history(lookup_value, verify_ssl=None)[source]
This method retrieves the user assignment history for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
lookup_value – An Agent ID or email address with which to look up the user
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Tyype lookup_value:
str, int
- Returns:
JSON data for the assignment history for the agent
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.NotFoundResponseError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
- get_user_info(lookup_value, verify_ssl=None)[source]
This method retrieves user data for a specific agent.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationAdded in version 2.0.0.
- Parameters:
lookup_value – An Agent ID or email address with which to look up the user
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Tyype lookup_value:
str, int
- Returns:
JSON data with the agent user data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.InvalidFieldError,freshpy.errors.exceptions.DataMismatchError
Tickets Subclass (freshpy.core.FreshPy.Tickets)¶
- class FreshPy.Tickets(freshpy_object)[source]
This class includes methods associated with Freshservice tickets.
- get_ticket(ticket_number, include=None, verify_ssl=None)[source]
This method returns the data for a specific ticket.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 2.0.0: Updated the function call to use keyword arguments.
Changed in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
- Returns:
JSON data for the given ticket
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_ticket_field(field_id=None, field_label=None, field_name=None, match_case=True, ticket_data=None, workspace_id=None, verify_ssl=None)[source]
This method retrieves a specific ticket field based on a provided ID, Label, and/or Name.
Added in version 3.0.0.
- Parameters:
field_label (str, None) – The
labelvalue for the fieldfield_name (str, None) – The
namevalue for the fieldmatch_case (bool) – Determines if the
labelvalue should be case-sensitive (Trueby default)ticket_data (dict, list, None) – Dictionary or list containing all ticket field data (optional)
workspace_id (str, int, None) – The ID of a specific workspace (defaults to primary workspace if not specified)
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
A JSON-formatted dictionary with the field data (or an empty dictionary if the field is not found)
- Raises:
freshpy.errors.exceptions.InvalidPredefinedFilterError,freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.GETRequestError,freshpy.errors.exceptions.APIRequestError
- get_ticket_fields(workspace_id=None, verify_ssl=None)[source]
This method retrieves the standard and custom fields that exist for tickets.
Added in version 3.0.0.
- Parameters:
- Returns:
Dictionary (JSON) with the ticket field data
- Raises:
freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError
- get_tickets(include=None, predefined_filter=None, filters=None, filter_logic='AND', requester_id=None, requester_email=None, ticket_type=None, updated_since=None, ascending=None, descending=None, per_page=None, page=None, verify_ssl=None)[source]
This method returns a sequence of tickets with optional filters.
Changed in version 3.0.0: Changed the default
verify_sslparameter to beNoneand called method to check SSL verificationChanged in version 1.1.0: Added the ability to disable SSL verification on API calls.
Added in version 1.0.0.
- Parameters:
include (str, tuple, list, set, None) –
A string or iterable of embedding options
predefined_filter (str, None) – One of the predefined filters (‘new_and_my_open’, ‘watching’, ‘spam’, ‘deleted’)
filters (str, dict, None) – Query filter(s) in the form of a structured query string or a dictionary of values
filter_logic – Defines the logic to use as necessary in a filter query string (default is
AND)requester_id (str, int, None) – The numeric ID of a requester
requester_id – The numeric ID of a requester
requester_email (str, None) – The email address of a requester
ticket_type (str, None) – The type of ticket (e.g.
Incident,Service Request, etc.)updated_since (str, None) – A threshold date or timestamp (in UTC format) for when the ticket was last updated
ascending (bool, None) – Determines if the tickets should be sorted in ascending order
descending (bool, None) – Determines if the tickets should be sorted in descending order (default)
per_page (str, int, None) – Displays a certain number of results per query
page (str, int, None) – Returns a specific page number (used for paginated results)
verify_ssl (bool) – Determines if SSL verification should occur (
Trueby default)
- Returns:
A list of JSON objects for tickets
- Raises:
freshpy.errors.exceptions.InvalidPredefinedFilterError,freshpy.errors.exceptions.APIConnectionError,freshpy.errors.exceptions.DataMismatchError