Thursday, July 12, 2018

How to use POSTMAN for MS DYNAMICS NAV 2018 API /MS BUSINESS CENTRAL?

Hi ,

If you have not read my earlier post than please go to below link before moving further in this blog

post.

API Creation in NAV and Setup

So I am going to give you an example of NAV API where I can insert , update , modify and delete

data using postman in database.

What is POSTMAN ?

As a NAV developer , I am new to this term but world is so advance and we need to be with them.

POSTMAN is basically a testing tool for and API.

As I understood one thing API is nothing but a URL which will give me data and do other things 

which will help me out in transaction. So I will never be interacting with original database.

POSTMAN has some attributes methods which interact with API.

What are attributes we have in POSTMAN?

POSTMAN can be downloaded from this LINK

There are 4 main transactions we do in any database.

1. Insert for this POSTMAN has POST

2. Delete for this POSTMAN has DELETE

3. Modify for this POSTMAN has PATCH

4. Select for this POSTMAN has GET

GET all API from NAV :

GET http://NAV2017:7048/DynamicsNAV110/api/beta/$metadata


GET http://nav2017:7048/DynamicsNAV110/api/beta/companies


How to get company information using API ID FIELD?

GET http://NAV2017:7048/DynamicsNAV110/api/beta/companies(68a76662-a198-477b-8097-d9df2116514a)/companyInformation


How to create a Customer or any entity in NAV?

POST http://desktop-jsuo248:7048/DynamicsNAV110/api/beta/companies(cbc66cd3-c138-4bfb-81f8-c5142f303a15)/customers

ENTER THE RAW FORMAT AS SHOWN IN SCREEN :


How to modify a Customer  or any entity in NAV?

PATCH http://desktop-jsuo248:7048/DynamicsNAV110/api/beta/companies(cbc66cd3-c138-4bfb-81f8-c5142f303a15)/customers(d39e6dfa-dfcf-4524-b02a-93d8c8967562)



How to delete a Customer or any enitity in NAV ?

DELETE http://desktop-jsuo248:7048/DynamicsNAV110/api/beta/companies(cbc66cd3-c138-4bfb-81f8-c5142f303a15)/customers(d39e6dfa-dfcf-4524-b02a-93d8c8967562)



How to use FIlters in API URL?

GET http://desktop-jsuo248:7048/DynamicsNAV110/api/beta/companies(cbc66cd3-c138-4bfb-81f8-c5142f303a15)/items?$filter=unitPrice%20gt%20100

How to get details about any Sales Invoice or any document from NAV?

GET http://desktop-jsuo248:7048/DynamicsNAV110/api/beta/companies(cbc66cd3-c138-4bfb-81f8-c5142f303a15)/salesInvoices(9dec16d6-122b-4ed3-ba0f-ac62dd562409)?$expand=salesInvoiceLines




Last 2 methods for creating Sales Invoices and posting it can be checked at








2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. How to make a PATCH request to modify data in Business Central? I am getting error :
    "code": "BadRequest_MethodNotAllowed",
    "message": "Entity does not support modifying data. CorrelationId: 381a2431-c776-4338-8052-045ba2d4ec10."

    ReplyDelete