Solved

ODataV4 $expand returns 404

  • 23 February 2024
  • 2 replies
  • 50 views

I’m attempting to use the $expand parameter in an OData v4 query. However, anything that I put in the $expand just causes the server to return 404. For example, I can get a PO with POOrder(OrderType='RO',OrderNbr='12345'). And it returns the POLineCollection property, already expanded. But if I explicitly request ?$expand=POLineCollection, I just get a 404. What’s strange to me is that if I set ?$expand= it does not expand the POLineCollection property. So it is definitely reading the $expand parameter.

I’ve tried expanding multiple navigation properties, using their names defined in the OData metadata XML. None of them work. I’ve even tried copy-pasting the examples from Exact Session Title (acumatica.com) as well as the URL provided in the answer to this topic, with the same result: 404. 

I have no idea what I’m doing wrong here.

For reference, here’s my full URL: https://myinstance.com/ODatav4/My Tenant Id/POOrder(OrderType='RO',OrderNbr='12345')?$expand=POLineCollection

icon

Best answer by shawnbeachy 23 February 2024, 21:36

View original

2 replies

Well, 5 hours later I feel properly dumb. I’m using Insomnia to send my requests, and didn’t realize that $expand was already being set in the Query tab. I was attempting to set it in my URL, which of course resulted in 2 “$expand” parameters.

Userlevel 7
Badge

Thank you for sharing your solution with the community @shawnbeachy!

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