I'm going crazy and can't figure this out.
In Postman, I'm calling
Deleting items with Postman works just fine for ProductsV2, but not for Product Categories. I'm baffled.
Any help would be greatly appreciated.
Thanks,
Tom
Then I would debug the entity to see where things go wrong.
Really? Yes, it's tested. It's not an assumption. The Product Categories can be deleted from the UI without issue.
The UI actually uses https://...Services/ReliableCommunicationManager.svc/ProcessMessages?cmp=abc&lng=en-us& instead of making a restful call, which I was hoping to see.
For whatever it's worth, the UI does prompt and ask if the user wants to check if the category is referenced by other documents. I'm wondering if that has anything to do with it, perhaps there is another method/resource that needs to be called or pass something in the body stating that the delete operation is "confirmed", however, the documentation that I can find doesn't say anything of the sort. And again, using both Postman and an OData client in c# return success statueses from the server, although it's not deleted.
Can you please test your assumption that it should be able to get deleted?
Yes it should be able to be deleted; there is nothing assigned to them. And if that were the case, I'd hope for an HTTP status code other than success or no content/204. Thanks for the thought though!
Can the category be deleted? Maybe it can't, because it's already used somewhere and deleting it would lead to inconsistent database.
Update: Not that I really expected anything different, but using the Odata client in c# performs the exact same way. I call delete and the data is still there:
class Program { public static string ODataEntityPath = ClientConfiguration.Default.ActiveDirectoryResource "/data"; static void Main(string[] args) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Uri oDataUri = new Uri(ODataEntityPath, UriKind.Absolute); var context = new Resources(oDataUri); context.SendingRequest2 = new EventHandler(delegate (object sender, SendingRequest2EventArgs e) { var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true); e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader); }); var category = context.ProductCategories.AsEnumerable().SingleOrDefault(p => p.ProductCategoryHierarchyName == "Physical Inventory" && p.CategoryName == "test4"); if (category == null) { Console.WriteLine("can't find category"); Console.ReadLine(); return; } context.DeleteObject(category); context.SaveChanges(); Console.ReadLine(); } }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156