Documentation Index

Fetch the complete documentation index at: https://docs.staedean.com/llms.txt

Use this file to discover all available pages before exploring further.

Web service GET request

Prev Next

This example calls a Microsoft Dynamics 365 Business Central web service and stores the response as a message to pass on in the pipeline. The following prerequisites are required:

  • The URL for the web service.

  • User credentials to access the service.

  • Postman to create the authorization string.

Create a new connection

  1. Create a new connection, give it a name, and add the WEBSERVICEENDPOINT element.

  2. Select Edit on the subpage ribbon to open the element.

Get the URL

  1. Open your Microsoft Dynamics 365 Business Central web client by navigating to your environment in your browser.

  2. Search for the Web Services page and open it.

  3. Navigate to the record for Page 42 Sales Order. Copy the OData V4 URL:

http://bcsaas203-default:7048/BC/ODataV4/Company('CRONUS%20International%20Ltd.')/SalesOrder?tenant=BCSaaS203-default

Add filters

Microsoft Dynamics 365 Business Central web services use the querystring to filter the dataset retrieved from the service. The following example adds filters on the Sell-To Customer and Status fields.

Note

The filter stores in the $filter key.

$filter=Sell_to_Customer_No eq '30000' and Status eq 'Released'

Add this to the web service URL:

http://bcsaas203-default:7048/BC/ODataV4/Company('CRONUS%20International%20Ltd.')/SalesOrder?tenant=BCSaaS203-default&$filter=Sell_to_Customer_No%20eq%20%2730000%27%20and%20Status%20eq%20%27Released%27

Note

The environment used in this example is a sandbox container named BCSaaS203 with the tenant as default.

Set up authorization

Several ways to authorize a web request exist. Authorization typically adds to the headers of a web request, though some scenarios add it to the querystring. Common types are: No Authorization, API Key, Basic Auth, Bearer Token, OAuth 1.0, and OAuth 2.0.

Microsoft Dynamics 365 Business Central web services support Basic and OAuth 2.0 authorization. Basic authentication is deprecated in SaaS environments.

This example uses Basic Auth with a web service key:

  1. Navigate to Users and select the user to use.

  2. Enable the web service key for that user. To copy the web service key, you must be logged in as that user in Microsoft Dynamics 365 Business Central.

  3. Copy the web service key to a temporary location. Use Postman to create the authorization header.

    Webservice User Card

  4. Open Postman and create a new web request. If prompted to create an account, select Skip and go to app at the bottom of the screen.

  5. In Postman, create new (Ctrl+N) and select a new HTTP request.

  6. In the untitled request, navigate to the Authorization tab, select Basic Auth in the dropdown, and enter your username and web service key in the corresponding fields.

    Postman Authorization Tab

  7. Switch to the Headers tab and copy the value of the Authorization key.

    Postman Headers Tab

    Note

    If the Authorization key is not visible, select the x hidden button.

    Postman Hidden Headers

  8. Go back to the connection and add the key and value to the Headers.

    Webservice Endpoint Setup page on Headers Tab

Run a test call

  1. Select the Test Call button in the ribbon of the WEBSERVICEENDPOINT setup page.

  2. Select Call webservice on the new page. A popup may appear requesting permission to submit requests.

    Pop-up Allowing http requests

    Webservice Test call Result

The test call result has two parts: the status code of the call (200 OK) and the body of the response.

Status Code: 200 (OK)
{"@odata.context":"http://bcsaas203-default:7048/BC/ODataV4/$metadata#Company('CRONUS%20International%20Ltd.')/SalesOrder","value":[{"Document_Type":"Order","No":"101005","Sell_to_Customer_No":"30000","Sell_to_Customer_Name":"John Haddock Insurance Co.","Status":"Released",...}]}

Only the body stores in the message when using the WEBSERVICEENDPOINT element in your connections.

Follow-up steps

With the data received from the web service, create an internal document to use the data further down the pipeline:

  1. Set up the WEBSERVICEENDPOINT.

  2. Create an external document from the web service response.

  3. Use the JSON to XML Translator activity to transform the web service response to XML or external document format.

  4. Create an internal document with the tables and fields to update in Microsoft Dynamics 365 Business Central.

  5. Use the Mapper activity to map the data to the internal document format.

  6. Use the Record Generator activity to create or update the Microsoft Dynamics 365 Business Central data based on the response.