Trouble Ticket Open API Developer Guide
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- Developer guides
Use the Trouble Ticket Open API to manage ticket information between external ticketing systems and the Now Platform. This API creates, updates, and retrieves data from the Case [sn_customerservice_case] and Incident [incident] tables.
This developer guide provides information on how to extend the Trouble Ticket Open API to make various customizations.
Extending the Trouble Ticket Open API
The Trouble Ticket Open API can be extended by editing script includes.
TMFTroubleTicketAPIConstants
: Contains constants and required parameter information.TMFTroubleTicketAPIUtil
: Contains functions to handle POST, GET, and PATCH requests.TroubleTicketProcessorOOB
: Contains helper functions that support functions in TMFTroubleTicketAPIUtil.TroubleTicketProcessor
: An empty script include file. Use this file to define any functions that you want to override from TroubleTicketProcessorOOB.
Extend the Trouble Ticket Open API to make the following customizations.
Required parameters
TMFTroubleTicketAPIConstants.TROUBLE_TICKET_CREATION_SCHEMA
: Sets the required request body parameters to create a ticket.TMFTroubleTicketAPIConstants.TROUBLE_TICKET_UPDATE_SCHEMA
: Sets the required request body parameters to update a ticket.
Request body validation
true
by default. These
functions are called in TMFTroubleTicketAPIUtil. verifyGetRequestForCase()
- Called byprocessGetRequestForCase()
.verifyPatchRequestForCase()
- Called byprocessPatchRequestForCase()
.verifyPostRequestForCase()
- Called byprocessPostRequestForCase()
.verifyGetRequestForIncident()
- Called byprocessGetRequestForIncident()
.verifyPatchRequestForIncident()
- Called byprocessPatchRequestForIncident()
.verifyPostRequestForIncident()
- Called byprocessPostRequestForIncident()
.
false
, it stops the API
operation. To apply custom validation, override TroubleTicketProcessorOOB helper
functions by creating functions with identical names and parameters in
TroubleTicketProcessor. These new TroubleTicketProcessor functions will be called by
TMFTroubleTicketAPIUtil to replace the default TroubleTicketProcessorOOB helper
functions.Additional REST operations
To create additional operations beyond the existing GET, PATCH, and POST operations, create additional scripted REST resources for the Trouble Ticket Open API. The logic of the new scripted REST resources should be consistent with the existing operations. Define functions for the new operations in TMFTroubleTicketAPIUtil.
Field mapping
When creating or updating records, the API maps request body parameters to case and incident record fields. When retrieving records, the API maps record fields to response object attributes.
mapPatchRequestToCase()
mapPostRequestToCase()
mapPatchRequestToIncident()
mapPostRequestToIncident()
createGetResponseForCase()
createPatchResponseForCase()
createPostResponseForCase()
createGetResponseForIncident()
createPatchResponseForIncident()
createPostResponseForIncident()
Customize field mappings to add and retrieve data for additional case and incident fields, or to change the default mappings for fields. To customize the field mappings, override TroubleTicketProcessorOOB mapping functions by creating functions with identical names and parameters in TroubleTicketProcessor. These new TroubleTicketProcessor functions will be used by TMFTroubleTicketAPIUtil to replace the default TroubleTicketProcessorOOB mapping functions.
Mapping logic for choice fields
The State, Priority, and contact_type fields are choice fields, where each choice is composed of a label and a corresponding value. For example, if the State field is set to New, the label is New and the value is 1. The mapping between choice labels and values can be changed by overriding the choice field mapping functions.
transformCaseSeverity()
transformCaseChannel()
transformCaseStatus()
transformIncidentSeverityToUrgency()
transformIncidentSeverityToImpact()
transformIncidentChannel()
transformIncidentStatus()