Skip to main content

Notifications

Announcements

No record found.

Supply Chain Management forum
Answered

How To Update Released Products via API \ Postman?

Posted on by 125
Hi all,
 
I can successfully create Released Products in D365 F & O via a POST request to the Data Entity: /data/ReleasedProductsV2
 
However, how do I update Released Products?  At the moment I am testing in POSTMAN.
 
Using PATCH I have tried:
 
/data/ReleasedProductsV2(ItemNumber='001234')
 
And in the body:
{
            /SearchName/: /Some text goes here/
}
 
But I receive a 404 // Not Found.
 
I have also tried variations:
 
PATCH: /data/ReleasedProductsV2(ProductNumber='001234')
 
PATCH: /data/ReleasedProductsV2(ProductNumber='001234',dataAreaId = 'A123')
 
But I still receive the 404.
 
If I change Product Number to Item Number I receive a 400 // Internal Server Error:
 
/data/ReleasedProductsV2(ItemNumber='001234',dataAreaId = 'A123')
 
What am I missing?
 
 
  • Michael Hutcheson Profile Picture
    Michael Hutcheson 125 on at
    How To Update Released Products via API \ Postman?
    Hello Layan,
     
    I have followed your suggestion and it has worked - many thanks.
     
    Regards,
     
    Michael
  • Verified answer
    Layan Jwei Profile Picture
    Layan Jwei 7,079 Super User 2024 Season 2 on at
    How To Update Released Products via API \ Postman?
    Hi Community member,

    This a weird behaviour I noticed with this entity only as well. To solve this you need to make sure that the user assigned to the clientId has the same dataAreaId that you use in postman.

    So for example, if you want to use DataAreaId = D1

    URL/data/ReleasedProductsV2(ItemNumber='abc',dataAreaId = 'd1')?cross-company=true
     
    Then you need to go to the user assigned to the clientId you use that is defined in Azure active directory and make sure the dataAreaId assigned to this user is also D1 and Save


     
     

    You need to change this  each time you change the dataAreaId in postman -- give it a try and let me know if it works.

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future. You can do this by ticking the box "Does this answer your question"
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,552 Super User 2024 Season 2 on at
    How To Update Released Products via API \ Postman?
    .Hi Community Member,
     
    'No resources were found' means that it couldn't find a record to be updated. Are you sure the product is available in the company? 
    If so, then check your default company in Dynamics 365 F&O? Is this also 'A123'? If not, try to set it to this company or enable the cross company option with the keyword 'cross-company=true'.
  • Michael Hutcheson Profile Picture
    Michael Hutcheson 125 on at
    How To Update Released Products via API \ Postman?
    Removing the spaces did not resolve it but thanks for the suggestion.
     
    FYI - The exact error in the logs are:
     
    {
        "error": {
            "code": "",
            "message": "An error has occurred.",
            "innererror": {
                "message": "No resources were found when selecting for update.",
                "type": "Microsoft.Dynamics.Platform.Integration.Services.OData.ODataArgumentException",
                "stacktrace": "   at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateManager.GetEntityForUpdate(IQueryable query, EntityType entityType)\r\n  
    at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataController.GetChangeInfoWithConcurrencyCheck(RequestEntityInfo requestEntityInfo)\r\n  
    at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataController.Patch()\r\n  
    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClassc.<GetExecutor>b__6(Object instance, Object[] methodParameters)\r\n  
    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   a
    t System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   a
    t System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown ---\r\n  
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
    at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
            }
        }
    }
     
     
     
    This line 'IDictionary`2 arguments' stands out?
  • Martin Dráb Profile Picture
    Martin Dráb 228,552 Most Valuable Professional on at
    How To Update Released Products via API \ Postman?
    The error is weird; the description does not match the status code. My guess it's really an internal server error, therefore we're resolved the problem with URL and the request reaches F&O. It fails there, but that's a different problem. Event logs might reveal more details.

    By the way, will it make any difference if you try my URL instead of yours? Mine doesn't contain spaces.
     

  • Michael Hutcheson Profile Picture
    Michael Hutcheson 125 on at
    How To Update Released Products via API \ Postman?
    Hello,
     
    In Postman if I submit a PATCH: /data/ReleasedProductsV2(ItemNumber='001234',dataAreaId = 'A1234')
     
    It defo say 400 \ Internal Server Error:
     
  • Martin Dráb Profile Picture
    Martin Dráb 228,552 Most Valuable Professional on at
    How To Update Released Products via API \ Postman?
    Using ProductNumber is definitely wrong, because the entity key is ItemNumber, not ProductNumber.
     
    I would expect ReleasedProductsV2(ItemNumber='001234',dataAreaId='A123') to work. Maybe the URL is correct and it fails for some other reason.
     
    By the way 400 is not not Internal Server Error (that's 500). 400 is Bad Request. Which one of them are you getting?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans