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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Getting 401 Unauthorized error when posting a GET method with auth token in X++

(0) ShareShare
ReportReport
Posted on by 25

I'm trying to call another provider's API through X++, but am getting a 401 unauthorized error. I'm able to connect if I post the GET request through Postman or Flow, but I'm having trouble converting this process to X++.

This is what my code looks like:

5050.pastedimage1588202095176v1.png

And this is what my Flow looks like. I'm just doing a GET request using the HTTP request. This Flow works properly and gets the data I'm expecting without an unauthorized error. What could I be missing in my X++ code?

0743.pastedimage1588202147594v2.png

I have the same question (0)
  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Good Morning,

    I believe that the PowerAutomate community is the better forum that might be able answering your question.

    Can you have a look at this forum here and possibly create a new question there?

    powerusers.microsoft.com/.../MPACommunity

    Best regards,

    Ludwig

  • MATTGUO Profile Picture
    22,349 Moderator on at

    Hi Dynamics user,

    Finance and Operations production and sandbox environments support only secured communication that uses TLS 1.2 or later.

    Please try to add the following line of code:

    System.Net.ServicePointManager::set_SecurityProtocol(System.Net.SecurityProtocolType::Tls12);

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 732 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 289 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans