cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

ODATA expand

rleir
17-Peridot

ODATA expand

Hi all,

By reading the WRS manual I can see that some tables can be expanded: CR's can be expanded to show AffectedObjects.

 

/Windchill/servlet/odata/v5/ChangeMgmt/ChangeRequests?$select=Description,AffectedSystem,LastModified,Name,Number&$filter=startswith(Name, 'Foo-')&$count=false&$expand=AffectedObjects

 

Also the manual shows these available to expand in a Parts query:

 

$expand=Uses/$ref
$expand=AlternatePart
$expand=Alternates($expand=AlternateFor
$expand=Alternates($expand=Alternate)
$expand=Alternates($expand=AlternatePart
$expand=SubstitutePart
$expand=PartDocAssociations($expand=RelatedCADDoc)
$expand=PartDocAssociations($expand=RelatedPart)

 

These are shown in example code. Are there other table relations that can be expanded? I was hoping to see RelevantRequestData as something which can be expanded.

Ok, yes, this is configurable, but what is the default?

And which server-side XML configures this?

thanks

Rick

ACCEPTED SOLUTION

Accepted Solutions
rhart
16-Pearl
(To:rleir)

Hi @rleir 

Perhaps it's 'navigation criteria' that indicates what can be expanded, then it seems to depend somewhat on context.

For example, there is a 'resultingobjects' nav criteria, but we would not expect to expand change request to on it.

 

2021-10-13_164451.png

 

2021-10-13_164544.png

View solution in original post

4 REPLIES 4
rleir
17-Peridot
(To:rleir)

Hi all

Here is a server-side file (snippet below) which might be part of the answer:

 Windchill_11/Windchill/codebase/rest/ptc/domain/ChangeMgmt/v5/entity/ChangeItems.json

This suggests that we can expand "organizationOwned", "VersionedChangeMgmt" and a few others. 

Now my question is a bit clearer: "Where is the documentation for WRS saying what can be expanded in each domain"?

Thanks

Rick

 

A snippet from the file: 

  "inherits":[
          {
            "name": "organizationOwned"
          },
          {
            "name": "VersionedChangeMgmt"
          },
          {
            "name": "LifecycleManagedChangeMgmt"
          },
          {
             "name": "ProcessLinks"
          },
          {
             "name": "ProcessObjects"
          },
          {
             "name": "ReferenceLinks"
          },
          {
             "name": "ReferenceObjects"
          },
          {
             "name": "AffectsLinks"
          },
          {
             "name": "AffectedObjects"
          }
      ],

 

rleir
17-Peridot
(To:rleir)

More on the above. My info is for ChangeRequest.

I am using https://domain/Windchill/netmarkets/html/wrs/doc.html  -- In the right frame, GET /ChangeRequests

 

Clearly I need to learn more about this. I tried expanding these:

"name": "organizationOwned" -- no, cannot be expanded
"name": "VersionedChangeMgmt" -- no, cannot be expanded
"name": "LifecycleManagedChangeMgmt" -- no, cannot be expanded
"name": "ProcessLinks" -- nothing for us, 
"name": "ProcessObjects" -- nothing for us
"name": "ReferenceLinks" -- links to a wt.change2.ChangeReferenceLink
"name": "ReferenceObjects" -- links to another ChangeRequest
"name": "AffectsLinks" -- links to wt.change2.RelevantRequestData2 which you will recognize when you have been using QueryBuilder
"name": "AffectedObjects" -- links to Documents

rhart
16-Pearl
(To:rleir)

Hi @rleir 

Perhaps it's 'navigation criteria' that indicates what can be expanded, then it seems to depend somewhat on context.

For example, there is a 'resultingobjects' nav criteria, but we would not expect to expand change request to on it.

 

2021-10-13_164451.png

 

2021-10-13_164544.png

rleir
17-Peridot
(To:rhart)

Hi Rhart

Good eye, the navigation criteria identifies things that can be expanded. I marked your reply as the solution, thanks! Though there seem to be some big gaps in the doco for the 'expand' feature.

In a Change Request, AffectsLinks links to a wt.change2.RelevantRequestData2 OID number. Compare this in QueryBuilder: you can link from a Change Request to a Changeable, typically a Document or Part. But with ODATA you just get a RelevantRequestData2 OID number. Can you use that and identify the Document via an ODATA query?

 

Sometimes in ODATA examples they show nested 'expand' clauses.  I tried a few possibilities, such as $expand=AffectsLinks($expand=RelevantRequestData2). But no luck, you could be nearly correct but a single character error or wrong case can make the query fail with a useless message.

thanks

Rick

 

Announcements


Top Tags