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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

GET data from Dynamics CRM using a web Api in R

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I want to read customer data from dynamics crm using the programming language R. I try to use an API to do that. This is my code:

library (httr)

usr <- "yourusernamehere"
pwd <- "yourpasswordhere"
url <- "https://companynamehere.api.crm4.dynamics.com/api/data/v9.1/"

GET(url,authenticate(usr,pwd)

Response [https://companynamehere.api.crm4.dynamics.com/api/data/v9.1/]
  Date: 2019-11-19 09:30
  Status: 401
  Content-Type: 

I get status 401. My username and password is 100% correct.  I tried the api also for the microsoft Business central. The same method worked succesfully for Microsoft Business Central. 

Can somebody help me out. Great thanks in advance! A solution in python is also welcome.

Lennart

I have the same question (0)
  • Suggested answer
    Daniel Schneider Profile Picture
    172 on at

    Hi Lennart,

    are you sure the url is companyname.api.crm4.dynamics.com? I only use companyname.crm4.dynamics.com

    Regards,

    Daniel

  • Lennart Jongen Profile Picture
    5 on at

    That still doesn't work. When I paste the 2 urls in the webbrowser I gain the same result. Is that weird?

  • Lennart Jongen Profile Picture
    5 on at

    That still doesn't work. When I paste the 2 urls in the webbrowser I gain the same result. Is that weird?

  • Lennart Jongen Profile Picture
    5 on at

    That did not work, weird thing is when i use the 2 url's in the webbrowser i get the same results.

  • Daniel Schneider Profile Picture
    172 on at

    Ok sorry, my misstake. The URL for OnPremise and Online are different. What is the result if you put companynamehere.api.crm4.dynamics.com/.../ directly in the Browser?

  • Daniel Schneider Profile Picture
    172 on at

    Ok sorry, my misstake. The URL for OnPremise and Online are different. What is the result if you put companynamehere.api.crm4.dynamics.com/.../ directly in the Browser?

  • Lennart Jongen Profile Picture
    5 on at

    I get some response. A big screen full of text that I am not sure what it means yet.  But first I had to sign in on CRM with my account. Otherwhise I get error 401 in the webbrowser.

    Btw thank you for your time

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

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans