Using Web Services to Copy a Ticket

This how-to article will help Administrators to use Workflow Web Services to copy an existing ticket in the TDAdmin interface. The user must have Administrator access in TDAdmin.


Web service steps open up extensive possibilities for [things that can occur on a ticket within TeamDynamix as part of a ticketing workflow. This article serves as an example of adding a ticket workflow step that will copy a ticket. This could be used to do something like copying an existing tickets’ values that want to be used on another ticket that gets created as part of a process. i.e. offboarding an employee.

Learn more about setting up and using web service steps.

There are a few steps needed to set up a workflow step that will copy a ticket:

  1. Get a copy of the current ticket via an API call.
  2. Create a second API call which creates a new ticket with data from the original ticket.

Getting a Copy of the Current Ticket Details Via the API 

Provider – TDX provider; see Preparing to build a TeamDynamix web service method.

Authentication – TDX auth provider; see Preparing to build a TeamDynamix web service method.

Method: GET

URL: https://yourTeamDynamixDomain/TDWebAPI/API/[appID]/tickets/{{id}}

            The appID is just the numeric value, no [ ] needed.

Headers: Key: content-type | Value: application/json

Parameters: AppID – integer – From Ticket – Application ID (if you already know the ticketing appID, enter it above in the URL, and disregard adding it to Parameters.

TicketID-Integer – From Ticket -ID

Body: leave blank as GET does not require a Body.

Creating the Web Service Method

To create a web service method that will pull the current ticket details: 

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the Ticketing application you want to add this workflow step to.
  3. Click Workflow Web Services in the left navigation, then click Web Service Methods.
  4. Click the +New button.
  5. On the New Web Service page, enter a Name for the method. This name will show up in the workflow builder.
  6. In the Web Service Provider field, enter the web service provider you've already defined.[where?]
  7. Click the Method button to the left of the URL field and select GET.
  8. In the URL field, enter https://[Your TeamDynamix URL]/TDWebApi/api/[Your Ticket App ID]/tickets
  9. Click the Headers tab and define one of the following headers:
    1. Key – Content-type
    2. Value – application/json 
  10. Click the Add button to add the header.
  11. Click the Parameters tab and define one of the following parameters: 
    1. AppID – Integer – From Ticket – Application ID
    2. TicketID – Integer – From Ticket – ID 
  12. Click the Add button to add the parameter.
  13. Click the Save button.

The Body field is intentionally left blank, GET requests should have no body value. 

Storing the Get Ticket API Call Results in the Workflow 

Add a workflow step to call the Get Ticket method (from above) and store the results in the workflow with a meaningful name, such as GetTicketDetailsRespBody. Whatever you name the result is how you will need to reference it in a different web service method. For example: 


Create a Ticket from the First Ticket’s Details 

Start out with a web service method based on Using web services to create a second ticket. However, you’ll need to change the parameters to pull from the previous API info stored in the workflow like so: 

(Zoom to see image better. Note that not all fields are listed here, just an example of how to do it). 

Note here the From Workflow selections. This says to pull information from data saved in the workflow. You now reference the name of the object you received from the Get Ticket API call (1) and saved in (2). If you named this GetTicketDetailsRespBody in the workflow, this will be GetTicketDetailsRespBody. You reference properties in that object by specifying things like GetTicketDetailsRespBody.TypeID (or other field which match up to the API documentation from a GET ticket request). 

To retrieve the value of a custom attribute which has a choice, enter a format like this: 

To retrieve the value of a custom attribute which allows multiple choices, enter a format like this: 

Gotchas & Pitfalls

  • The values you put in the URL and the ResponseCode and ResponseBody are case sensitive. Be aware of this when making these.
100% helpful - 1 review


Article ID: 49812
Wed 3/7/18 5:42 PM
Wed 6/23/21 3:57 PM