OData URL forming for Postman testing

I'm new to working with OData and have gone over the documentation but am still having difficulties getting started.  I created my OData service and added the necessary published resources. I need data from various cross-module associations.  To get started I want to get the team leader information which is stored in a different module so I can extract specific, related information based on the leader for a form. I need to traverse from the Team module to my AgentDatabase module where my Agent entity resides. That entity contains the FullName attribute.   I'm starting in postman just to get a feel for how I need to build it all out.  I have been trying to use $expand and experimenting with other tactics with no luck.  I thought I needed something like: //localhost:8080/odata/OData_Team/Teams?$expand=Agent   Any guidance would be appreciated. 
1 answers

Hi Andrew,


Mendix expects you to specify which attributes you need from the expanded entity.


For example. assume an OData API which provides endpoints for the Claims and Customer resources. You can retrieve claims with the associated customer as follows:


GET http://localhost:8080/odata/InsurancePortalApi/v1/Claims?$expand=Customer($select=CustomerId,Firstname)&$top=20&$count=true&$orderby=ClaimId asc&$select=ClaimId,Summary,ClaimFiledDate,TotalAmount,DateOfOccurence,ClaimStatus



POST http://localhost:8080/odata/InsurancePortalApi/v1/Claims/$query
Accept: application/json, application/atom+xml
Content-Type: text/plain



Here are screenshots when you run it in visual studio code with the rest plugin (similar to postman):




As of Mendix 9.17 every OData API also includes an OpenAPI contract and a Swagger test page. This might be useful to explore OData APIs (but at the moment the expand support is not fully provided yet).


You can also expand more than one level. For example, assume Claims → Customer → Address:



POST http://localhost:8080/odata/InsurancePortalApi/v1/Claims/$query HTTP/1.1
User-Agent: vscode-restclient
Accept: application/json, application/atom+xml
Content-Type: text/plain
accept-encoding: gzip, deflate
content-length: 210
cookie: JSESSIONID=node0bspzqzi7bb5y10wofqpag1qu75.node0