PostMan 调用Dynamics 365 WebApi

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/setup-postman-environment#bkmk_connectonpremise

 

Connect with an on-premises environment

  1. Launch the Postman desktop application.
  2. Select the Environment Options gear icon in the top-right corner.
  3. In the Manage Environments dialog box, select the Add button to add a new environment.
  4. In the dialog box that opens, add a name for the environment. Then copy the following key-value pairs into the editing space.
Variable NameValue
urlhttp://yourservername/yourorgname
version9.0
webapiurl{{url}}/api/data/v{{version}}/

Create a new Postman environment to connect with On-premise instance

  1. Replace the instance URL placeholder value with your Dynamics 365 for Customer Engagement apps instance URL, and select Add to save the environment.
  2. Close the Manage environments dialog box.

Set credentials

  1. On the Authorization tab, select NTLM Authentication [Beta].
  2. Set the following values in the form:
    Username. Type the alias only; do not include the domain.
    Password. You have the option to show the password.
    Domain. You must set this if you are accessing the account from a different domain, although you can set it to ~ so that the default domain of the server is used.

Your authentication might look like this if you are logging in as an administrator.

Click on Authorization tab, and select NTLM Authentication

Test your connection

Create a new Web API request to test the connection with your Dynamics 365 for Customer Engagement apps instance. Use the WhoAmI function:

  1. Select GET as the HTTP method and add {{webapiurl}}WhoAmI in the editing space. WhoAmI function request
  2. Select Send to send this request.
  3. If your request is successful, you see the data from the WhoAmIResponse ComplexType that is returned by the WhoAmI Function.

 

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/setup-postman-environment#connect-with-your-common-data-service-environment

Connect with your Common Data Service environment

This environment uses a client ID for an application that is registered for all Common Data Service environments.

You can use the clientid and callback values supplied in these instructions. However, when building your own application, you should register your own Azure Active Directory (Azure AD) application.

To register your own Azure AD application, see the steps described in Walkthrough: Register a Common Data Service app with Azure Active Directory.

Use these steps to create a Postman environment that you can use to connect with your Common Data Service instance:

  1. Launch the Postman desktop application.
  2. Select the Environment Options gear icon in the top-right corner.
  3. In the Manage Environments dialog box, select the Add button to add a new environment.

Click on Add button to add a new Postman environment

  1. In the dialog box that opens, type a name for the environment. Then add the following key-value pairs into the editing space.

    Variable nameValue
    urlhttps://<add your environment name, like ‘myorg.crm’>.dynamics.com
    clientid51f81489-12ee-4a9e-aaae-a2591f45987d
    version9.0
    webapiurl{{url}}/api/data/v{{version}}/
    callbackhttps://callbackurl
    authurlhttps://login.microsoftonline.com/common/oauth2/authorize?resource={{url}}

    Create a new Postman environment to connect with Online instance

  2. Replace the instance URL placeholder value with the URL of your Common Data Service instance, and select Add to save the environment.

  3. Close the Manage environments dialog box.

Generate an access token to use with your environment

To connect using OAuth 2.0, you must have an access token. Use the following steps to get a new access token:

  1. Make sure the new environment you created is selected.

  2. Select the Authorization tab.

  3. Set the Type to OAuth 2.0.

  4. Verify that you have selected the environment that you created.

  5. Select Get New Access Token

    In Authorization tab, set Type to OAuth 2.0

  6. Set the following values in the dialog box. Select Implicit from the Grant Type drop-down menu. You can set the Token Name to whatever you like, and leave other keys set to default values.

    Get new Access Token

    Note

    If you are configuring environments in Postman for multiple Common Data Service instances using different user credentials, you might need to delete the cookies cached by Postman. Select the Cookies link, which can be found under the Send button, and remove the saved cookies from the Manage Cookies dialog box.
    Remove Cookies
    Some of these cookies are very persistent. You can delete some of them in groups, but you might have to delete others individually. You might need to do this twice to ensure that no cookies remain.

  7. Select Request Token. When you do this, an Azure Active Directory sign-in page appears. Enter your username and password.

  8. After the token is generated, scroll to the bottom and select Use Token. This closes the Manage Access Tokens dialog box.

  9. After you have added a token, you can select which token to apply to requests. On the Available Tokens drop-down list, select the token you have just created. The Authorization header gets added to the Web API request.

See Test your connection for steps to verify your connection.

Test your connection

Create a new Web API request to test the connection with your Common Data Service instance. Use the WhoAmI function:

  1. Select GET as the HTTP method and add {{webapiurl}}WhoAmI in the editing space. WhoAmI function request
  2. Select Send to send this request.
  3. If your request is successful, you see the data from the WhoAmIResponse ComplexType that is returned by the WhoAmI Function.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值