Skip to main content
Solved

Error deleting related item from Stock Item via REST API

  • July 9, 2025
  • 2 replies
  • 54 views

I’ve extended the Stock Item entity and added Related Items to the entity.  I can successfully add new related items to the stock item as well as query the item and get the related items attached to it, but I can’t seem to remove a related item once it has been added other than using the web interface and manually removing it.

The URL being accessed via PUT is

https://MyTenant/entity/MyCustomEndpoint/1.100.001/StockItem

JSON being sent is

{
"InventoryID":{"value":"601-0669"},
"RelatedItems":
[
{
"LineID":null,
"Delete":{"value":true},
"ID":{"value":"d6fdf2bf-565b-f011-8427-120e4ffdb993"}
}
]
}

I’ve tried providing the ID as well as the LineID, but get the same error: "The request is invalid: An exception occurred during input parsing"

I’m using the exact same method to add/remove vendor details, attributes, etc. on stock items, but just can’t seem to get it to work with related items.

Anyone have any suggestions on how to accomplish this?

 

Best answer by Vignesh Ponnusamy

Hello ​@AllenVaughn,

I was able to delete the RelatedItems using InventoryID and LineID like below,

{
"InventoryID": {
"value": "AACOMPUT01"
},
"RelatedItems": [
{
"InventoryID": {
"value": "ACCOMODATE"
},
"LineID": {
"value": 4
},
"Delete": true
}
]
}

Also, please note the Delete should set to true like in above example. 

Feel free to post back if you have any questions, Good Luck!

2 replies

Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hello ​@AllenVaughn,

I was able to delete the RelatedItems using InventoryID and LineID like below,

{
"InventoryID": {
"value": "AACOMPUT01"
},
"RelatedItems": [
{
"InventoryID": {
"value": "ACCOMODATE"
},
"LineID": {
"value": 4
},
"Delete": true
}
]
}

Also, please note the Delete should set to true like in above example. 

Feel free to post back if you have any questions, Good Luck!


  • Author
  • Freshman I
  • July 10, 2025

That got it.  Apparently the Delete property needs to be a bool instead of a BoolValue.

I tested it without the InventoryID on the related item and that works as well.  So the only required properties are LineID and the Delete flag.

Thanks for the help.