Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Answered

How to debug from Postman ?

Posted on by 504
Hi,
 
For a custom service class, which usually we tested it from Postman, how to debug it in development VM ?
As per my understanding, to test in Postman, I have to create environment and input the credentials for D365 FO application like TenantId, ClientId, secret key, secret value, etc, example below:
The D365 FO that we called is the cloud hosted with the custom service class we already deployed.
 
But in Development VM, we connect to local installation, to load D365 FO also we're using https://usnconeboxax1aos.cloud.onebox.dynamics.com/ , how is the setting to make Postman can call service to this local D365 FO, so then I can debug when it is being called. 
 
Should we create new environment in that Postman but put the resource address to that https://usnconeboxax1aos ? what about the rest of the setting like TenantId, ClientID, etc ?
 
I'm a newbie on this, so a bit blank what is the necessary thing to do.
 
Thanks
 
  • Ken Manhattan Profile Picture
    Ken Manhattan 504 on at
    How to debug from Postman ?
    Hi Layan,
     
    Yes it was solved, but I tried many time to check the "Does this answer your question?", always failed. Keep processing without end until I need to close the browser. Can you help ? I want to check yours reply on 18 Dec. Thanks.
  • Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 Season 2 on at
    How to debug from Postman ?
    Hi Ken,
     
    Is this answered or do you still need help?
  • Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 Season 2 on at
    How to debug from Postman ?
    Hi Ken,
     
    As I mentioned before, you can use the same clientId and make sure you've put it in the sysAdmin setup. Then all you need to do is change the URL and resource to ur devBox in postman and that's it.
     
    You also have the option to create a new registration id, in this case you need to put the new clientId in FO setup. And in postman you'll need to change the clientId and secret. Tenant Id should stay the same.
     
    If the clientId you already have, is used in UAT then you can utilize it in ur devBox and no need to create a new one.
    However if it's used in Production, then definitely create a new one.
     
    Please don't forget to verify the answers that helped you
     
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future. You can do this by ticking the box "Does this answer your question"
  • Ken Manhattan Profile Picture
    Ken Manhattan 504 on at
    How to debug from Postman ?
    Hi Layan / all,
     
    If I have my configuration of my company's cloud hosted (UAT environment) for the client Id, client secret, and obviously the tenant id, can I use that for my Postman local environment ? so I just need to change the resource variable to "https://usnconeboxax1aos.cloud.onebox.dynamics.com/" only.
     
    This client id is the one listed in D365 FO - SysAdmin\Setup\Entra ID Application, isn't it ? So, as long as in my Postman environment, I have set the same ClientID, with the correct Client Secret and TenantId, but resource is to "https://usnconeboxax1aos.cloud.onebox.dynamics.com/", I already can call my custom service class from that Postman (in my DevBox) and debug accordingly ?
     
    or do I really need to create new App Register and put "https://usnconeboxax1aos.cloud.onebox.dynamics.com/" in the redirect URL when we register new ? then I should use this new App Registration, means new Client Id and Client secret Id and value ? and I would also need to put this new Client Id in my D365 FO SysAdmin\Setup\Entra ID Application ?
     
    Thanks,
  • Verified answer
    Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 Season 2 on at
    How to debug from Postman ?
    Hi Ken,

    1. As you already did, you need to to make sure you define the clientId in FO
    2. You need to call the authorization api to get the token (by specifying the clientId, clientsecret, grantType and resource) in the body. Ans specifying the tenatId in the URL
    The resource will be your devBox url
     
     
    3. you need to call the custom service url and define the access token there
    devBoxUrl/api/services/serviceGroup/service/method
    then go to headers  and add Authorization in the key section and in the value add the word Bearer with the accessToken you got from the first auth call.

    you might add to the body if you need to pass values to the service
     
    Now before you click send, make sure you added break points and started the debugging, after that click send and the debugging will work



    And in general yes, you can create a new environment and define values for your new DevBox... but TenantId will stay the same. And if you defined the same clientId in your devBox then the client secret will also be the same.
    so if you just change the url when getting the token and when calling the actual service, then things should work

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future. You can do this by ticking the box "Does this answer your question"
  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    How to debug from Postman ?
    In Postman, you need to make two calls. One to obtain an authorization token, which is communication with Azure Active Directory, not F&O. Before you can do it, you must make an app registration in AAD, where you'll define which environment to use and you'll get things like client ID. And then you make a call to URL of a particular F&O environment with the authorization token.
     
    Refer to documentation mentioned by Kevin to get more details.
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    How to debug from Postman ?
    Hi,
    You can check this official document and follow the steps he introduces to set it up: Test services by using third-party utilities - Finance & Operations | Dynamics 365 | Microsoft LearnPostman is a tool that is often used to interact with RESTful services (such as OData) in scenarios that involve the development and testing of application programming interfaces (APIs). This procedure isn't an endorsement of Postman, and other similar tools are available. However, we are using Postman to illustrate the concepts and messages that are involved when you use OAuth to authenticate with Azure AD, and then make OData requests to and receive responses from the application.
    Best regards,
    Kevin

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans