Solved

Get Complex structures in ODATA

  • 29 December 2022
  • 2 replies
  • 170 views

Userlevel 1
Badge +4

Would it be possible to get complex/deep structures in one single ODATA call/response? A simple example would be getting an article from PartCatalog and its linked gtins (PartGtin). In the projection it is possible to use an array to get the PartGtin records, but to get both PartCatalog and PartGtin you need two rest calls.

Can I model my projection in a way that I can get the full structure of both PartCatalog and PartGtin by only one call and one response. A similar case would be to get PurchaseOrder and all PurchaseOrderLines for one order, with just one call and one response.

This is kind of convenient to use in integrations, when the requesting party want to receive the full structure with just one call

icon

Best answer by Tomas Ruderfelt 29 December 2022, 13:00

View original

2 replies

Userlevel 7
Badge +19

Yes it is possible. One example is the premium API projection AssortmentService:

In API documentation there is an action “GetAssortment” where you can get out assortment nodes for an assortment with child arrays of parts, attributes etc.:

If you start to look how that is implemented you see that parts of the model looks like this:

 

There is of course more things involved, for example since it is an action you have the PL/SQL implementation in the .plsql file but it is simple since you get code generated for the fetching of the structure.

Look at AssortmentService.projection, AssortmentServiceUtil.fragment and AssortmentServiceUtil.plsql in INVENT module to see how it is implemented.

Userlevel 1
Badge +4

Thanks Tomas, it did work as you said. Now, I can produce a response with a two-level structure (part and the gtins, as an example). Very convenient when working with integration and the remote party want a complete structure:
 

 

Reply