Skip to main content
12-Amethyst
February 2, 2021
Solved

Custom code to get data using OData API

  • February 2, 2021
  • 1 reply
  • 5670 views

Hello All,

I have created a integration connector with oData connector as base template and able to connect windchill.
Using new composer I am able to map the existing endpoints. For example Workflow/WorkItems. I am able to get few of the APIs available in WRS but not able to see all the exact API Endpoints for example I can see endpoints for GET /WorkItems but I can't see endpoint for GET /WorkItems('{WorkItemId}')/Subject
Also, I didn't find any useful document/code which tells how to invoke GET /WorkItems('{WorkItemId}')/Subject endPoint. Where we can pass WorkItemId as an input parameter and get the details. In case of Legacy Rest I was using below code to get the data. Not sure how to achieve the same using OData.

var jsonResult = me.processJSONRequest(params);

Any idea, how to achieve above requirement using OData REST API.

Best answer by schauvelin

Hi,

Issue discussed through case :

 

In ODATA connector, create a Service and enter information below :

  • Endpoint (required) : getWorkItemInWorkItemsByID (/Workflow/Workitems({'ID'}) GET)
  • $expand : Subject

 

schauvelin_0-1613139286975.png

 

Solution reported in article : https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS338990 

If solution provided is ok for you can you mark this post as "Accepted Solution"

 

Kind regards. 

1 reply

15-Moonstone
February 9, 2021

Since you are asking about integration between ThingWorx and Windchill first of all verify that you have latest supported versions of WRS for Windchill, Windchill Patches and Integration Runtime installed.

 

Next verify the API you want to use in ThingWorx is available in Windchill and test it there first. If you have done this and still not working can you let me know what version of Windchill, WRS, Integration Runtime and ThingWorx you are using?

12-Amethyst
February 9, 2021

Thank you for your reply on this!

I believe we have latest supported version of WRS for Windchill and integration-runtime. 

I verified the API that I am looking for is available in Windchill, I have ran it in Windchill and it returns the data well. I have attached all the required screenshots. I hope the screen shots help. I would like to know how can I get data for /WorkItems/('{workflowid}')/subject REST call from my Thingworx service. All I could see are few out of the box services available for /WorkflowItems in Odata Connector and not all as is seen in Windchill. It will be really great if you can let me know how I can include and call these services from Thingworx.

Please let me know if you need any further detail.

 

 

12-Amethyst
February 9, 2021

Forgot attachment in the previous reply so attaching it now