Skip to main content
Solved

Get Complex structures in ODATA

  • December 29, 2022
  • 2 replies
  • 221 views

LevFredrB
Sidekick (Partner)
Forum|alt.badge.img+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

Best answer by Tomas Ruderfelt

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.

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+20
  • Superhero (Employee)
  • 488 replies
  • Answer
  • December 29, 2022

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.


LevFredrB
Sidekick (Partner)
Forum|alt.badge.img+4
  • Author
  • Sidekick (Partner)
  • 9 replies
  • December 30, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings