Skip to main content
17-Peridot
October 6, 2021
Solved

ODATA expand

  • October 6, 2021
  • 2 replies
  • 4945 views

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

Best answer by rhart

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

2 replies

rleir17-PeridotAuthor
17-Peridot
October 13, 2021

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"
 }
 ],

 

rleir17-PeridotAuthor
17-Peridot
October 13, 2021

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

rhart16-PearlAnswer
16-Pearl
October 13, 2021

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

16-Pearl
March 12, 2025

Another way to do this is view the $metadata for the endpoint and look at the available Navigation Properties. 

E.g. /Windchill/servlet/odata/v8/ChangeMgmt/$metadata

 

<EntityType Name="ChangeRequest" BaseType="PTC.ChangeMgmt.GenericChangeRequest">
<Property Name="COMMERCIALLY_RESTRICTED" Type="Edm.String">
<Annotation Term="PTC.SecurityLabel"/>
</Property>
<Property Name="CabinetName" Type="Edm.String">
<Annotation Term="PTC.ReadOnly"/>
</Property>
<Property Name="ChangeAdminI" Type="Collection(PTC.ChangeMgmt.ChangeAdmin)"/>
<Property Name="Complexity" Type="PTC.EnumType"/>
<Property Name="EXPORT_CONTROLLED" Type="Edm.String">
<Annotation Term="PTC.SecurityLabel"/>
</Property>
<Property Name="FolderLocation" Type="Edm.String">
<Annotation Term="PTC.ReadOnly"/>
</Property>
<Property Name="FolderName" Type="Edm.String">
<Annotation Term="PTC.ReadOnly"/>
</Property>
<Property Name="IPCopyrightStatement" Type="Edm.String"/>
<Property Name="IP_CONTROLLED" Type="Edm.String">
<Annotation Term="PTC.SecurityLabel"/>
</Property>
<Property Name="MarshallProprietaryData" Type="Edm.Boolean"/>
<Property Name="NonRecurringCost" Type="Edm.String"/>
<Property Name="ObjectType" Type="Edm.String">
<Annotation Term="PTC.ReadOnly"/>
</Property>
<Property Name="ProposedSolution" Type="Edm.String"/>
<Property Name="ProposedSolutionSummary" Type="Edm.String"/>
<Property Name="RecurringCost" Type="Edm.String"/>
<Property Name="RequestPriority" Type="PTC.EnumType"/>
<Property Name="ReservedBy" Type="Edm.String">
<Annotation Term="PTC.ReadOnly"/>
</Property>
<Property Name="SECURITY_CAVEAT" Type="Edm.String">
<Annotation Term="PTC.SecurityLabel"/>
</Property>
<Property Name="SECURITY_CLASSIFICATION" Type="Edm.String">
<Annotation Term="PTC.SecurityLabel"/>
</Property>
<Property Name="TeamTemplateName" Type="Edm.String">
<Annotation Term="PTC.ReadOnly"/>
</Property>
<NavigationProperty Name="ChangeAdministratorI" Type="Collection(PTC.PrincipalMgmt.Principal)"/>
<NavigationProperty Name="CRAffectLinks" Type="Collection(PTC.ChangeMgmt.RelevantRequestDataLinkItem)" ContainsTarget="true"/>
<NavigationProperty Name="Context" Type="PTC.DataAdmin.Container" Nullable="false"/>
<NavigationProperty Name="Folder" Type="PTC.DataAdmin.Folder"/>
<NavigationProperty Name="Attachments" Type="Collection(PTC.ContentItem)" ContainsTarget="true"/>
<Annotation Term="Core.Description">
<String>ChangeRequest</String>
</Annotation>
<Annotation Term="PTC.Operations">
<String>READ,CREATE,UPDATE</String>
</Annotation>