Advanced Customization > Upgrade Your Custom Tasks
  
Upgrade Your Custom Tasks
If you created custom tasks in PTC Navigate 1.4 or earlier, the WindchillConnectorThing.processJSONRequest was the center of all REST API execution. The connector took a REST URL-driven approach. With the current Runtime Integration connector, based on WindchillSwaggerConnector, the approach is service-driven. As a result, to migrate your tasks to the connector, we’ll need to predefine a service on the connector for the specific REST URL you have been using. Follow the recommended steps below to replace the processJSONRequest API.
* 
If your custom task is created using Info*Engine tasks as well as REST services, see also the next topic, Upgrade a Custom Task that has Info*Engine Tasks
1. Either use ptc-windchill-integration-connector, the new Runtime Integration connector Thing that is included with the PTC Windchill Extension, or create your own connector and use WindchillSwaggerConnector as the Thing Template reference. When upgrading, we recommend that you duplicate our out-of-the-box connector ptc-windchill-integration-connector and customize the duplicated connector. Otherwise, you’ll lose your own customized connector.
2. Create a service for the operationType and the URL that are used in the processJSONRequest API calls on the connector.
If you need more information on creating services, start with the ThingWorx Help topic “Thing Services
3. In the service, list all queryParams as in earlier versions of ThingWorx Navigate. Make sure that your param names exactly match the names expected by the service.
4. If you have POST requests, add these items to the queryParams section:
a. CSRF token. To get a token, execute the service on the connector Security_Get_CSRF.
b. Data (JSONObject) param. In previous releases, this was a separate param in the processJSONRequest calls.
5. Make sure the connector is a Thing that can be identified by name:
Thing connector = (Thing)EntityUtilities.findEntity(connector,ThingworxRelationshipTypes.Thing);
6. Start the service on the connector Thing:
InfoTable serviceResult = connector.processServiceRequest(serviceName,params);
7. Use WindchillServicesConnector.InvokeService(operationType,serviceName,queryParams) as a reference and util API for for use in any custom APIs or tasks.