Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Connect Custom BC API To Python

Posted on by 4
Hello, I am trying to connect a custom BC API which I added in Web Services, and access the information using a GET request in Python. 
 
Here in my Python code
 
import requestsfrom requests.auth import HTTPBasicAuthimport jsonr = requests.get(URL,auth=HTTPBasicAuth(uid,pwd))#Display Infoprint(r.headers)print(r.text)
 
However i'm getting the error that I need to use OAuth; how would I implement OAuth in this code to Authenticate my request and access my custom BC APi?
 
Any help is appreciated. 
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,565 Super User 2024 Season 2 on at
    Connect Custom BC API To Python
    Hi, hope the following helps.
     
    Thanks.
    ZHU
  • ArshiaSistan Profile Picture
    ArshiaSistan 4 on at
    Connect Custom BC API To Python
    Im not sure what happend to the code formatting in the Original Post 
     
    import requests
    from requests.auth import HTTPBasicAuth
    import json
    r = requests.get(URL,auth=HTTPBasicAuth(uid,pwd))
     
    #Display Info
    print(r.headers)
    print(r.text)

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans