Solved

OData4 - Inventory Items. Expand Attributes

  • 8 December 2022
  • 1 reply
  • 299 views

Userlevel 2
Badge

I am trying to port some of my calls over from using the Rest API to using the ODATA4 interface. Using a simple call like this…

 

http://ODATAV4_URL/PX_Objects_In_InventoryItem?$filter=InventoryCD eq 'BCWICFGBLK’&$format=json

 

How to include a list of all the attributes and values associated to a InventoryItem. With the RestAPI, I could just $expand=Attributes and it would return that in the payload. I can’t seem to figure it out when using ODATA.

 

Thank you all!

 

Eric

icon

Best answer by Leonardo Justiniano 9 December 2022, 00:20

View original

1 reply

Userlevel 6
Badge +4

Hi @eelliston 

You might need to retrieve the NoteID for the specific InventoryItem and then query CSAnswers for existing assigned values.

URL/PX_Objects_Cs_CSAnswers?$skip=0&$top=10&$filter=RefNoteID eq '...'

$expand works on ID columns when the navigation properties are set. For example:

URL/?$expand=<Table>By<Field>

It depends on the foreign keys of the table defined at DAC level

 

You can expand for example Item Class tied to the Item like:

URL/InventoryItem?$filter=InventoryCD eq '...'&$expand=INItemClassByItemClassID

The result comes as

 

Attributes has no foreign key defined.

 

Otherwise use RESTAPI Get call to retrieve all those details in one call. 

 

Hope this helps.

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved