How can I access to Infusionsoft API from R

Hello everybody and happy new year

I am new in Infusionsoft API and please let me know how can I access Infusionsoft API from R (RStudio). For example read whole contacts and show them in R.
Thanks
Max

Happy new year @Max_Alireza, We don’t currently have any examples in R, but it should be possible to use an xmlrpc library and make requests to https://YOUR_APPLICATION.infusionsoft.com/api/xmlrpc with the examples found in the xmlrpc developer docs. There may even be REST libraries available for R which you would then use the REST developer docs as an example to get started. Your legacy API Key for xmlrpc can be found by using this guide. If you wish to use REST, you will need a developer account which can be created using this guide.

Hey @Max_Alireza, I did some more digging and found this for R. It doesn’t yet have any instructions and you will still need an xmlrpc library, but this should be a good start.

Best,
Carlos

Hi Carlos

Thanks for your help. But I didn’t find any XMLRPC package in R and also in
that codes.
It is much appreciated to let me know how can I write a xmlrpc command for
contacts retrieving while I could not find any notation for REST API or
XMLRPC in R functions (GET) for infusionsoft.
The problem is I don’t know how can I add API key and username for GET
command properly first and need further information for accessing.

url<-GET(“https://user.infusionsoft.com/api/xmlrpc/”)
url$status_code
[1] 200 this is OK

but
url2<-GET(“https://api.infusionsoft.com/crm/rest/v1/contacts/”)
url2$status_code

[1] 401 But how can I solve this?!

Sincerely,
Max

Hey @Max_Alireza I am not too familiar with this, but I think you should just be able to set your appName and privateKey values for the xmlrpc calls. Your appname should be a combination of letters and numbers.

Hi Carlos
Yes I set the app name (user in link) correctly but the problem is how can I access via GET command for api key and probably other parameters correctly. Apparently, 401 means it needs further information!

Here is a link to the R XMLRPC package, with install instructions: XMLRPC: Remote Procedure Call (RPC) via XML in R version 0.2-4 from R-Forge

Hi Josh
Thanks but apparently the XMLRPC in that page doesn’t work as well! you can run the sample code on that link online!