web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Using Postman (JSON/REST), I Can create a SalesOrder but can't find out how to add SalesOrderLines

(0) ShareShare
ReportReport
Posted on by

Hi. Hope someone can shed some light on my dilemma.

I am working against Nav 2016, and doing simple JSON/Rest webservcie calls. I am using Postman for testing fucntionality.

I can successfully create a SalesOrder by doing a POST to .../OData/Company('mycompany')/SalesOrder. But when I try to create the SalesOrderLines using the recommended methods I get errors that I can not resolve.

The URL structure I am attemting use is ...OData/Company('mycompany')/SalesOrder('1063')/SalesOrderLines

The 1063 is the SalesOrder number I got from creating my SalesOrder. The JSON schema looks like this:

{
"Type": "Item",
"TypeSpecified": true,
"No": "11444",
"Quantity": 1,
"QuantitySpecified": true
}

i.e. just trying to add one line. I however get this error no matter what I try

{
"odata.error": {
"code": "",
"message": {
"lang": "en-US",
"value": "The number of keys specified in the URI does not match number of key properties for the resource 'NAV.SalesOrder'."
}
}
}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    The Sales Order table key is Document Type and No, so passing only 1063 is not enough. You need to pass also the Document Type.
  • Community Member Profile Picture
    on at

    Hi Stefano,

    I'm a bit closer to solving this :-)

    This helped clarify the parameter issue. Thanks for that, but now I am having trouble with the URL

    ..../SalesOrder(Document_Type='Order', No='1063')/SalesOrderLine

    Giving me: "Resource not found for the segment 'SalesOrderLine'

    I am using ASP.NET CORE and no compliant Nuget packages exist yet, ergo the reason I am using raw http calls.

  • Community Member Profile Picture
    on at

    And btw also tried .../SalesOrderSalesLines which is listed in $metadata.

  • Community Member Profile Picture
    on at

    Please share the JSON of salesorder object . I am not able to create the salesorder.

    Regards

    Harminder Singh

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans