Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

GET data from Dynamics CRM using a web Api in R

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

  • Lennart Jongen Profile Picture
    Lennart Jongen 5 on at
    RE: GET data from Dynamics CRM using a web Api in R

    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

  • Daniel Schneider Profile Picture
    Daniel Schneider 170 on at
    RE: GET data from Dynamics CRM using a web Api in R

    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
    Daniel Schneider 170 on at
    RE: GET data from Dynamics CRM using a web Api in R

    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
    Lennart Jongen 5 on at
    RE: GET data from Dynamics CRM using a web Api in R

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

  • Lennart Jongen Profile Picture
    Lennart Jongen 5 on at
    RE: GET data from Dynamics CRM using a web Api in R

    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
    Lennart Jongen 5 on at
    RE: GET data from Dynamics CRM using a web Api in R

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

  • Suggested answer
    Daniel Schneider Profile Picture
    Daniel Schneider 170 on at
    RE: GET data from Dynamics CRM using a web Api in R

    Hi Lennart,

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

    Regards,

    Daniel

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans