Cannot retrieve data with "Enrich Data by Webservice"

rachel_lomaskyrachel_lomasky MemberPosts:52Guru
edited November 2018 inHelp

Hi,

I've downloaded the Web Mining extension and would like to use it to connect to a Google-provided webservice. I've constructed a GET url, and it works fine when I just paste it into a browser (bunch of JSON returned). However, when I run it with "Enrich Data by Webservice", I get:

Dec 3, 2016 10:31:57 AM SEVERE: Process failed: Cannot retrieve data from the specified URL 'https://www.googleapis.com/analytics/v3/data/ga'.
Dec 3, 2016 10:31:57 AM SEVERE: Here:
Dec 3, 2016 10:31:57 AM SEVERE: Process[1] (Process)
Dec 3, 2016 10:31:57 AM SEVERE: subprocess 'Main Process'
Dec 3, 2016 10:31:57 AM SEVERE: +- Retrieve questions[1] (Retrieve)
Dec 3, 2016 10:31:57 AM SEVERE: ==> +- Enrich Data by Webservice[1] (Enrich Data by Webservice)

Two questions:

1. Why doesn't it work?

2. Is there a way that I can see the query string to do debugging?

Thank you,

Rachel

Best Answer

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM ModeratorPosts:2,959Community Manager
    Solution Accepted

    here's a sample process (it's using RM 7.3):







    <运营商激活="true" class="process" compatibility="7.3.000" expanded="true" name="Process">

    <运营商激活="true" class="generate_data_user_specification" compatibility="7.3.000" expanded="true" height="68" name="Generate Data by User Specification" width="90" x="45" y="34">





    <运营商激活="true" class="web:enrich_data_by_webservice" compatibility="7.3.000" expanded="true" height="68" name="Enrich Data by Webservice" width="90" x="179" y="34">










    https://www.googleapis.com/analytics/v3/data/ga?ids=ga:XXXXX&amp;start-date=30daysAgo&amp;end-date=yesterday&amp;metrics=ga:sessions&amp;access_token=XXXXXX"/>









    I just tested this with my own Google API account and it works.

    Scott

Answers

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM ModeratorPosts:2,959Community Manager

    hi...I use Google API all the time with this operator and it is quite tricky to get all the settings right. First guess - did you encode your URL? Can you share your parameter settings (without your key of course)?

    The answer to your second question is no, RM does not give you the same verbose output as you would get with the terminal. Sometimes when I can't get it right, I do a cURL at the command line, get that to work, and then go back to RM.

    Scott

  • rachel_lomaskyrachel_lomasky MemberPosts:52Guru


    <运营商激活="true" class="retrieve" compatibility="7.2.003" expanded="true" height="68" name="Retrieve questions" width="90" x="45" y="85">




    <运营商激活="true" class="web:enrich_data_by_webservice" compatibility="7.2.001" expanded="true" height="68" name="Enrich Data by Webservice" width="90" x="246" y="85">








    <参数键= " assume_html " value = " true " / >




    https://www.googleapis.com/analytics/v3/data/ga"/>










  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM ModeratorPosts:2,959Community Manager

    hi ok thanks. It was hard to figure out that XML (it's from ver 7.2 and there's some strange cut and paste there) but I think I know what you're doing. I have not used Google Analytics API before but for a GET request, I would first try putting all the parameters in the URL, rather than in "request properties". Don't ask me why this makes a difference, but in my experience, it does. Try something like this in the URL:

    https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3Anumber here>&start-date=30daysAgo&end-date=yesterday&metrics=ga%3Asessions&access_token=

    I also don't see anything in your String Matching (called "Machting in the XML!) query so you'll need to tell RapidMiner what you want to do with the response. I would recommend just doing Regular Expression and using .* for now - just to ensure you're getting a response.

    Scott

  • rachel_lomaskyrachel_lomasky MemberPosts:52Guru

    Thank you, this works. Now to figure out how to parse the response...

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM ModeratorPosts:2,959Community Manager

    should not be too bad. There are a variety of tools to use. Post if you need more help.

    Scott


    rachel_lomasky
  • rachel_lomaskyrachel_lomasky MemberPosts:52Guru

    It ain't pretty, but I got it working:).

  • khairulnizamkhairulnizam MemberPosts:1Contributor I

    Hi, I have the same problem with the "Enrich Data by Webservice". I already tried the parameters using curl.. its work. Here is my process:







    <运营商激活="true" class="process" compatibility="7.4.000" expanded="true" name="Process">







    <运营商激活="true" class="text:create_document" compatibility="7.4.001" expanded="true" height="68" name="Create Document" width="90" x="45" y="136">




    <运营商激活="true" class="text:documents_to_data" compatibility="7.4.001" expanded="true" height="82" name="Documents to Data" width="90" x="179" y="136">




    <运营商激活="true" class="web:enrich_data_by_webservice" compatibility="7.3.000" expanded="true" height="68" name="Enrich Data by Webservice" width="90" x="313" y="136">










    <参数键= " assume_html " value = " true " / >




    https://twinword-sentiment-analysis.p.mashape.com/analyze/"/>
















  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1,761Unicorn

    I think there's a problem with your API key. I tried your XML code and get a JSON respons that say "

    {"message":"Missing Mashape application key. Go to http:\/\/docs.mashape.com\/api-keys to learn how to get your API application key."}

  • rachel_lomaskyrachel_lomasky MemberPosts:52Guru

    My problem was that I was quoting parameters. Everything should be non-quoted.

    Thomas_Ott
Sign InorRegisterto comment.