Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Commerce forum / Error when accessing r...
Commerce forum

Error when accessing retail API

(0) ShareShare
ReportReport
Posted on by 285

I am trying to access the retail API from a .net class using this example:

community.dynamics.com/.../how-to-access-retail-server-in-managed-code

However I'm getting the error below once it tries to execute

ChannelConfiguration channelConfiguration = await orgUnitManager.GetOrgUnitConfiguration();

Error:
Contoso.Retail.Ecommerce.Publishing.vshost.exe Error: 0 : System.InvalidOperationException: The response payload is a not a valid response payload. Please make sure that the top level element is a valid Atom or JSON element or belongs to 'docs.oasis-open.org/.../data' namespace.
   at Microsoft.OData.Client.Materialization.ODataMaterializer.CreateODataMessageReader(IODataResponseMessage responseMessage, ResponseInfo responseInfo, ODataPayloadKind& payloadKind)
   at Microsoft.OData.Client.Materialization.ODataMaterializer.CreateMaterializerForMessage(IODataResponseMessage responseMessage, ResponseInfo responseInfo, Type materializerType, QueryComponents queryComponents, ProjectionPlan plan, ODataPayloadKind payloadKind)
<-- Rest of stack trace cut -->

Any idea how to troubleshoot this?

  • Rob vanBrandenburg Profile Picture
    285 on at
    RE: Error when accessing retail API

    I don't know if we ever got this truly resolved, as the customer decided to go a different route.

    What I did find out is though that you need to 'enable' the channel via code, you will need to execute certain logic against the API from client code in order

    to enable it. I'll see if I can find it and post it here.

    Rob.

  • Community Member Profile Picture
    on at
    RE: Error when accessing retail API

    Hi Rob,

    I am getting same error can you please advice how to fix?

  • Rob vanBrandenburg Profile Picture
    285 on at
    RE: Error when accessing retail API

    Thanks Sergey. We've gotten a bit further with this. The retail URL was correct, but there were some issues with the setup in D365FO (application secrets etc) - it looks like we are getting close - we just need to get the online store published at this moment.

  • SergeyP Profile Picture
    2,928 on at
    RE: Error when accessing retail API

    Probably the Url you specified for your Retail Server is not correct, can you open yourretailserverurl/Commerce in the browser - what will you see?

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Commerce

Featured topics

Product updates

Dynamics 365 release plans