banboo-data / RBingAds

R API wrapper for the Bing Ads API
Other
2 stars 0 forks source link

Error: XML content does not seem to be XML: #24

Closed Alexander-Turubara closed 4 years ago

Alexander-Turubara commented 4 years ago

Hello, Johannes. I faced the error while using your repository, can you help me how to avoid or fix this issue? I attach all the code I used:

remotes::install_github("jburkhardt/RBingAds") library(RBingAds) bing_auth <- authenticate(save = F,

  • path = "C:/Users/myfile.bingauth",
  • gitignore = F) Authentication process needs your Bing Client ID. Enter Bing Client ID: ****----**** Paste the Client Secret: **** Paste the Developer Token: **** Please enter the code from the URL: *****----**** View(bing_auth) data <- load_bing_data(bing_auth = bing_auth,
  • account_id = "***",
  • report = "CampaignPerformanceReport",
  • columns = c("AccountName", "CampaignName",
  • "Impressions",
  • "Clicks", "Spend"),
  • start = "2019-11-01",
  • end = "2019-11-30") Error: XML content does not seem to be XML: ''
jenccnej commented 4 years ago

Confirm! I have the same error.

jburkhardt commented 4 years ago

Hi @Alexander-Turubara, @jenccnej Thank you for using the package! I guess, there is something wrong with the relative file path of the authentication object. The best practice is to run your code inside an RStudio project or at least set a working directory for your project before you run any code. Please do not use absolute paths like path = "C:/Users/myfile.bingauth" in your example. Instead, set a relative file path that refers to the working directory of your project. It is really difficult to troubleshoot your issue from remote. I develop the package on a mac os and unix system. I assume you are both on a Windows machine, right? This code just runs fine for me:

bing_auth <- authenticate(save = T,
                          path = ".bingauth",
                          gitignore = T)

data <- load_bing_data(bing_auth = bing_auth,
                       account_id = "*******",
                       report = "CampaignPerformanceReport",
                       columns = c("AccountName", "CampaignName", "TimePeriod", "Impressions", "Clicks", "Spend", "Conversions"),
                       start = "2019-01-01",
                       end = "2019-01-02")

How does the bing_auth object look like? Is is a dataframe containing an access and refresh token?

Alexander-Turubara commented 4 years ago

Thanks for your help, I really appreciate it.
Authentication went fine and bing_auth object has access and refresh token. I've changed the file path as you mentioned and set a working directory also before ran any code.
Yes, I use a Windows machine.

Here is the code I use but I still can see the error:

bing_auth <- authenticate(save = T,
                          path  = ".bingauth",
                          gitignore = T)

data <- load_bing_data(bing_auth = bing_auth,
                       account_id = "*******",
                       report = "CampaignPerformanceReport",
                       columns = c("AccountName", "CampaignName",
                                   "Impressions",
                                   "Clicks", "Spend"),
                       start = "2019-11-01",
                       end = "2019-11-30")
---------------------------------------------------------------------
`Error: XML content does not seem to be XML: ''`

Here is what I have in the bing auth object.

photo_2020-02-03_18-47-14

jenccnej commented 4 years ago

I figured out the problem Wrong account id And I passed the account number

Thanks anyway for your package!

jburkhardt commented 4 years ago

@jenccnej Does it work for you? Can you pull data from the Bing Ads API? @Alexander-Turubara Maybe you pass the wrong ID in the load_bing_data function?

Alexander-Turubara commented 4 years ago

@jenccnej I've changed account_id and everything works. Thank you both for the help

@jburkhardt Thanks for your package, it is really helpfull