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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 196 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans