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

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Post a JSON from Postman to Nav BC

(0) ShareShare
ReportReport
Posted on by 25

Good morning,

Or I think it's not possible to be done or there is something  I don't know. I need to create a new record in BC using Postman, I can't use anything else. I have the following JSON:

{

"value":[

{

            

            "Transaction_ID": "9000",

            "Prod_Order_No": "TEST-EMS1",

            "Line_No": 10000,

            "Operation_No": "10",

            "Item_No": "08692",

            "Quantity": "100",

            "Work_Center_No": "P1",

            "Standard_Task_Code": "",

            "Sales_Order_No": "ODV20-0030",

            "Sales_Order_Line_No": 10000,

            "Creation_Date": "2020-06-04T00:00:00",

            "Imported": true,

            "Error": ""

}

]

        }

that I put on body request. Request method is a POST, I insert right URL, authentication is NTLM with username and password, content-type application/json

Nothing: always error 400, if I change authentication, I'll receive error 401

Is it possible I miss something. I'm using postman. If I do a get it's ok, this is a json I find doing a get

Best regards

I have the same question (0)
  • Lars Lohndorf-Larsen Profile Picture
    on at
    RE: Post a JSON from Postman to Nav BC

    Hello,

    The value you have, is an array. A simple set of fields will work, for example:

    Insert a new customer:

    POST {{BaseUri}}/companies(85410dc0-d3e8-ea11-bb97-000d3a492d5b)/customers

    HEADER:

    Content-Type = application/json

    BODY (Raw):

        {
        "number": "10010",
        "displayName": "Test AS",
        "phoneNumber": "911 123",
        "email": "Contact@contoso.com"
        }

    That should return:

    pastedimage1601040399263v1.png

    Provided of course that authentication is OK - to check that, see if a simple GET {{BaseUri}}/companies(85410dc0-d3e8-ea11-bb97-000d3a492d5b)/customers works OK.

  • sdfs Profile Picture
    25 on at
    RE: Post a JSON from Postman to Nav BC

    Thanks you for you reply. Now I show you what I do. I think that NTLM is the root cause. Get function works properly, Post function gives error 400

    So I say it's a post method, with an url https://:

    UrlInsert.png

    I deleted society name but address is given to me by technicians

    Then I inserted authorization:

    2020_2D00_09_2D00_25-15_5F00_52_5F00_56_2D00_Window.png

    Username and password are sent to me by technicians. If I change authorization, I'll receive error 401

    Then I add the following header: application/json for content-type

    2020_2D00_09_2D00_25-15_5F00_53_5F00_39_2D00_Window.png

    Then I add the body:

    2020_2D00_09_2D00_25-15_5F00_54_5F00_10_2D00_Postman.png

    always the same error. I think NTLM is not supported as I read from web, because GET operation is running properly

    Best regards

  • Lars Lohndorf-Larsen Profile Picture
    on at
    RE: Post a JSON from Postman to Nav BC

    I assume that you have enabled NTLM as well in NST settings?

    pastedimage1601043762338v1.png

    As, per default it is not enabled.

    Authentication works the same way for read and write, so I suspect more there is a typo somewhere. How about if you try antother API for example "customers" and the example I sent?

  • sdfs Profile Picture
    25 on at
    RE: Post a JSON from Postman to Nav BC

    I need to explain you something. As I think you understand, I don't manage Nav BC, but I need to connect from Filemaker to it by webservice. THere is one thing also to say: NTLM authentication is not supported by Filemaker, for which I need to use in curl options --anyauth. This authorization doesn't give me any issues with GET operations, while Post gives me them. If I try using .Net, doing a development I think ic C#, there are no issues. Also Fiddler gives me problems

  • Suggested answer
    JAngle Profile Picture
    119 on at
    RE: Post a JSON from Postman to Nav BC

    Perhaps trying a different authentication is worthwhile. I typically use the web service method which is with basic authentication. You will need a web service key applying to the user account. For a POST I would typically add into the header If-Match *

  • Suggested answer
    JAngle Profile Picture
    119 on at
    RE: Post a JSON from Postman to Nav BC

    Similar post on the NAV forum which has a verified answer: community.dynamics.com/.../ntlm-authentication-for-nav-server-web-service-from-android

  • sdfs Profile Picture
    25 on at
    RE: Post a JSON from Postman to Nav BC

    Thank you. I solved my issue. It was inside postman and a field

  • Community Member Profile Picture
    on at
    RE: Post a JSON from Postman to Nav BC

    I experimented today a little with JSon arrays sent from BC - first using Azure functions in C# and JavaScript, but then I found out that I have Apache with PHP configured on my laptop, and tried the same with json_decode.

    Fullscreen

    A variation of the classics - "Hello World", but with a list of names in the body of the POST request.

    And the data I used is a slightly simplified version of your message: a json object containing an array of objects:

    Fullscreen

    And it works without any problems, no matter if I send content as application/json or text/plain. Looks like there is some conversion happening on the server side before the request body is passed to json_decode.

    Up

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,327

#2
Sumit Singh Profile Picture

Sumit Singh 2,734

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,599

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans