Web Programming

nexiles.gateway provides a extensive core api – see HTTP API – which enables client-side programming using simple web technologies. Below are some examples.


The following code snipped queries PTC Windchill for all CAD Documents matching the name pattern lego*.prt, but limiting the results to a maximum of 10 entries. The resulting JSON will contain for each result:

  • all meta data attributes
  • links to the Windchill details page
  • download links to all representations (visualizations)
  • download links to all the files of each document, including secondary content

Example using jQuery:

jQuery.getJSON("/Windchill/servlet/nexiles/tools/services/query/1.0/query?q={'name':'lego*.prt'}&assoc=files&assoc=ibas&assoc=representations", function(data) {
  console.log("Got " + data.count + " results.");
  jQuery.each(data.items, function (index, item) {
    /* access item here */

Example using ExtJS and CoffeeScript:

  url: "/Windchill/servlet/nexiles/tools/services/query/1.0/query?q={'name':'lego*.prt'}&assoc=vault_info&assoc=ibas&assoc=representations&field=number"
  success: (response) ->
    data = Ext.JSON.decode response.responseText
    for item in data.items
      console.log "#{item.number} details url: #{item.details}"
      for representation in data.representations
        console.log "representation: #{representation.role} #{representation.url}"
      for file in data.files
        # files access
      for iba in data.ibas
        # iba access

Server Side Programming

While not the main focus of nexiles.gateway, the core API is also available on the server side. We use Jython, a implementation of the Python language which targets the Java Virtual Machine. This allows us to use dynamic programming while having full access to the PTC Windchill API.

At nexiles, we do all our customer projects using this technique.

The examples below can be entered in an interactive shell using IPython, or packaged up and deployed on the server for production use.

The core API has modules for:

  • Querying Windchill Business Objects
  • Accessing and altering IBA Attributes
  • Accessing content files
  • Creating Windchill Objects
  • Accessing history and uses/used-by of CAD Parts

Additionally, you can of course use the official Windchill Java API – nexiles.gateway allows to freely mix and match.



This is only needed when doing explorative programming in an interactive shell on the client. For production use, the code would be packaged up and requests would be authenticated by the Windchill server.

To use the API we need to authenticate using utils.authenticate():

>>> import utils
>>> utils.authenticate("someuser", "apassword")


The module nexiles.tools.query contains a simple interface to Windchill queries:

>>> from nexiles.tools import utils
>>> from nexiles.tools import query

Now let’s do a query for all cad documents matching lego*. Let’s also be nice to the server and limit the search to 100 results.:

>>> results = query.find("wt.epm.EPMDocument", name="lego*", limit=100)

The results is a sequence of tuples, each containing the OID and the Windchill Business object. Let’s print the NAME, NUMBER and Iteration Identifier for each result:

>>> for oid, obj in results:
>>>     print obj.getName(), obj.getNumber(), obj.getIterationDisplayIdentifier()

Note how we can access Windchill Business Objects.