Message from discussion
Adding a URL that has an api key to the restlibrary
Received: by 10.180.90.198 with SMTP id by6mr104880wib.4.1336576781474;
Wed, 09 May 2012 08:19:41 -0700 (PDT)
X-BeenThere: excel-ramblings@googlegroups.com
Received: by 10.216.86.204 with SMTP id w54ls3570973wee.4.gmail; Wed, 09 May
2012 08:19:40 -0700 (PDT)
Received: by 10.180.83.74 with SMTP id o10mr107586wiy.1.1336576780872;
Wed, 09 May 2012 08:19:40 -0700 (PDT)
Received: by 10.180.83.74 with SMTP id o10mr107585wiy.1.1336576780852;
Wed, 09 May 2012 08:19:40 -0700 (PDT)
Return-Path: <br...@mcpher.com>
Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49])
by gmr-mx.google.com with ESMTPS id ei10si2742763wid.0.2012.05.09.08.19.40
(version=TLSv1/SSLv3 cipher=OTHER);
Wed, 09 May 2012 08:19:40 -0700 (PDT)
Received-SPF: neutral (google.com: 74.125.82.49 is neither permitted nor denied by best guess record for domain of br...@mcpher.com) client-ip=74.125.82.49;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 74.125.82.49 is neither permitted nor denied by best guess record for domain of br...@mcpher.com) smtp.mail=br...@mcpher.com
Received: by mail-wg0-f49.google.com with SMTP id ds1so324037wgb.30
for <excel-ramblings@googlegroups.com>; Wed, 09 May 2012 08:19:40 -0700 (PDT)
d=google.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-type:x-gm-message-state;
bh=RyXSKlepn8EOUvStlepnxtHWbBSy7cMvnd6OWagz15Q=;
b=c7F7Igew0Nt2aTojRs6zokCBL4G0syMyBGIwd3zfpiWUBP9tjT3jgf9eWpvjiQCDLU
e7LPxbgpcTMH79UrgIG+8ubWbGWbUjb/DEqZAfwZ4VjRD1ktTIoDrlYGXJkJzF6SpkrD
ymy1Y15sbkLxK7wwPKj4LZ2V8eUFCxS+pUJPROAgmUKKTZs1TWSh2wi5e0r27zKyWmmB
pMmhzynsSzVd08x87zRIeKe2miTiWnrzhlsoPNefnWl08V/bfQ02LxBEA0tFss20j+M0
EKUkACq0x0nFDMD3mdHiXoTx00aJdCJsuRDJXL4qA5s/X2x4bMmnDN4vl14TKZ63BBfg
rAKQ==
Received: by 10.50.88.168 with SMTP id bh8mr300188igb.29.1336576779937; Wed,
09 May 2012 08:19:39 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.43.117.129 with HTTP; Wed, 9 May 2012 08:19:18 -0700 (PDT)
In-Reply-To: <2b7d49ff-affb-44f4-bf49-80c24c4f4...@e15g2000vba.googlegroups.com>
References: <78a3dad1-20b2-4db6-9c95-295de7cb1...@e15g2000vba.googlegroups.com>
<CANijH0Xm1KgsEuYiUsA2m=NUWvtdMs8rBvrdmjStsZcCW8T...@mail.gmail.com> <2b7d49ff-affb-44f4-bf49-80c24c4f4...@e15g2000vba.googlegroups.com>
From: Bruce Mcpherson <br...@mcpher.com>
Date: Wed, 9 May 2012 10:19:18 -0500
Message-ID: <CANijH0VTtsttU0QV5LjhMf1AW9KTOiYn6xVK1sBjEZFFhiE...@mail.gmail.com>
Subject: Re: [Excel Ramblings 267] Re: Adding a URL that has an api key to the restlibrary
To: excel-ramblings@googlegroups.com
Content-Type: multipart/alternative; boundary=e89a8f3ba5512ee94b04bf9c0851
X-Gm-Message-State: ALoCoQkhT9LmRePal5agt9iw0DMpN7kE47elgH7skQ/BX0orKPPEJrwbySVLxKi2AMpMjMj+7YCO
--e89a8f3ba5512ee94b04bf9c0851
Content-Type: text/plain; charset=ISO-8859-1
Will
ok .. a couple of solutions.
- you make the query include the key each time..
- so your url would just be http://api.klout.com/v2/user.json/
- the query parameter each time would be <QUERY>/score?
key=xxxx"
- you dont bother with adding your term to the library, and just passed
the complete URL to the crest class
bruce
2. you query parameter would include the key
On 9 May 2012 03:24, Will Hanschell <will.hansch...@gmail.com> wrote:
> Brilliant Bruce, thank you - this is such a great resource.
>
> Your advice makes total sense and works perfectly for the URL I
> supplied. However, my issue still applies for the second call I need
> to make.
>
> Klout requires that you call their API once to convert a Twitter
> screenName (the rows in my spreadsheet) to a Klout ID. (This is what
> you helped me with before.)
> You then call the API again to lookup a Klout score for that Klout ID.
> The URL for that is "http://api.klout.com/v2/user.json/<QUERY>/score?
> key=xxxx" where <QUERY> is the query supplied, and here it's
> hierarchical I believe so I can't just swap the terms?
>
> These are probably very simple questions but this is the final step in
> this hack! So close!
>
> Will
>
> On May 9, 12:06 am, Bruce Mcpherson <br...@mcpher.com> wrote:
> > Will
> >
> > I dont know if you noticed the rest explorer... you can use this to play
> > around with what your rest query returns, as well as play around with the
> > parameters and URL.
> >
> > http://ramblings.mcpher.com/Home/excelquirks/json/restexplore
> >
> > As I mentioned,
> > "http://api.klout.com/v2/identity.json/twitter?
> > screenName=xxxxx&key=xxxxx<
> http://api.klout.com/v2/identity.json/twitter?%0AscreenName=xxxxx&key...>
> > "
> >
> > ..should be able to become
> > "http://api.klout.com/v2/identity.json/twitter?
> > key=xxxxx<
> http://api.klout.com/v2/identity.json/twitter?%0AscreenName=xxxxx&key...>
> > &screenName=xxxxx<
> http://api.klout.com/v2/identity.json/twitter?%0AscreenName=xxxxx&key...>
> > "
> >
> > btw .. the queryPerRow you specify, performs multiple queries - one for
> > each row in your input data. Is that what you want ? Sounds like you want
> > to give one single query and get multiple answers...
> >
> > bruce
> >
> > On 8 May 2012 14:21, Will Hanschell <will.hansch...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hello all.
> >
> > > I'm trying to add the Klout API to the restlibrary and am having some
> > > difficulty. I think this is because the API's URL is a different
> > > structure to all those in the library already. Whereas with existing
> > > URLs, the query (in this case a Twitter screenName) is simply appended
> > > to the end of the URL when making the API call, with this URL the
> > > query needs to be inserted into the middle of the URL as the "key"
> > > must be placed after it. (see below)
> >
> > > Here's my library:
> >
> > > With .add("klout id")
> > > .add "restType", erQueryPerRow
> > > .add "url", "http://api.klout.com/v2/identity.json/twitter?
> > > screenName=xxxxx&key=xxxxx<
> http://api.klout.com/v2/identity.json/twitter?%0AscreenName=xxxxx&key...>
> > > "
> > > .add "id"
> > > .add "treeSearch", True
> > > .add "ignore", vbNullString
> > > End With
> >
> > > I think that this whole issue is handled later on in the library - in
> > > the restquery function. Somewhere here:
> >
> > > Set cr = New cRest
> > > ' lets get the data
> > > If (sheetName <> vbNullString) Then
> > > Set dSet = New cDataSet
> > > With dSet.populateData(wholeSheet(sheetName), ,
> > > sheetName, , , , True)
> > > ' ensure that the query column exists if it was asked for
> > > If qType = erQueryPerRow Then
> > > If Not .headingRow.validate(True, sQueryColumn) Then
> > > Exit Function
> > > End If
> > > ' alsmost there
> > > Set cr = cr.init(sResults,
> > > qType, .headingRow.exists(sQueryColumn), _
> > > , dSet, bPopulate, sUrl, bClearMissing, _
> > > bTreeSearch, complain, sIgnore)
> > > End With
> >
> > > Does anybody have any ideas on this? Many hours so far and still
> > > scratching my head.
> >
> > > Thanks!
> >
> > > Will
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Excel Ramblings" group.
> > > To post to this group, send email to excel-ramblings@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > excel-ramblings+unsubscribe@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/excel-ramblings?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Excel Ramblings" group.
> To post to this group, send email to excel-ramblings@googlegroups.com.
> To unsubscribe from this group, send email to
> excel-ramblings+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/excel-ramblings?hl=en.
>
>
--e89a8f3ba5512ee94b04bf9c0851
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Will<br><br>ok .. a couple of solutions.<br><ul><li>you make the query incl=
ude the key each time..</li><ul><li>=A0so your url would just be<a href=3D"=
http://api.klout.com/v2/user.json/" target=3D"_blank"> http://api.klout.com=
/v2/user.json/</a></li>
<li>the query parameter each time would be <QUERY>/score?<br>
key=3Dxxxx"</li></ul><li>you dont bother with adding your term to the =
library, and just passed the complete URL to the crest class</li></ul><p>br=
uce<br></p>2. you query parameter would include the key<br><br><br><div cla=
ss=3D"gmail_quote">
On 9 May 2012 03:24, Will Hanschell <span dir=3D"ltr"><<a href=3D"mailto=
:will.hansch...@gmail.com" target=3D"_blank">will.hansch...@gmail.com</a>&g=
t;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Brilliant Bruce, thank you - this is such a great resource.<br>
<br>
Your advice makes total sense and works perfectly for the URL I<br>
supplied. However, my issue still applies for the second call I need<br>
to make.<br>
<br>
Klout requires that you call their API once to convert a Twitter<br>
screenName (the rows in my spreadsheet) to a Klout ID. (This is what<br>
you helped me with before.)<br>
You then call the API again to lookup a Klout score for that Klout ID.<br>
The URL for that is "<a href=3D"http://api.klout.com/v2/user.json/" ta=
rget=3D"_blank">http://api.klout.com/v2/user.json/</a><QUERY>/score?<=
br>
key=3Dxxxx" where <QUERY> is the query supplied, and here it'=
;s<br>
hierarchical I believe so I can't just swap the terms?<br>
<br>
These are probably very simple questions but this is the final step in<br>
this hack! So close!<br>
<br>
Will<br>
<div class=3D"im"><br>
On May 9, 12:06=A0am, Bruce Mcpherson <<a href=3D"mailto:br...@mcpher.co=
m">br...@mcpher.com</a>> wrote:<br>
> Will<br>
><br>
> I dont know if you noticed the rest explorer... you can use this to pl=
ay<br>
> around with what your rest query returns, as well as play around with =
the<br>
> parameters and URL.<br>
><br>
> <a href=3D"http://ramblings.mcpher.com/Home/excelquirks/json/restexplo=
re" target=3D"_blank">http://ramblings.mcpher.com/Home/excelquirks/json/res=
texplore</a><br>
><br>
> As I mentioned,<br>
> "<a href=3D"http://api.klout.com/v2/identity.json/twitter" target=
=3D"_blank">http://api.klout.com/v2/identity.json/twitter</a>?<br>
</div>> screenName=3Dxxxxx&key=3Dxxxxx<<a href=3D"http://api.klou=
t.com/v2/identity.json/twitter?%0AscreenName=3Dxxxxx&key.." target=3D"_=
blank">http://api.klout.com/v2/identity.json/twitter?%0AscreenName=3Dxxxxx&=
amp;key..</a>.><br>
<div class=3D"im">> "<br>
><br>
> ..should be able to become<br>
> "<a href=3D"http://api.klout.com/v2/identity.json/twitter" target=
=3D"_blank">http://api.klout.com/v2/identity.json/twitter</a>?<br>
</div>> key=3Dxxxxx<<a href=3D"http://api.klout.com/v2/identity.json/=
twitter?%0AscreenName=3Dxxxxx&key.." target=3D"_blank">http://api.klout=
.com/v2/identity.json/twitter?%0AscreenName=3Dxxxxx&key..</a>.><br>
> &screenName=3Dxxxxx<<a href=3D"http://api.klout.com/v2/identity=
.json/twitter?%0AscreenName=3Dxxxxx&key.." target=3D"_blank">http://api=
.klout.com/v2/identity.json/twitter?%0AscreenName=3Dxxxxx&key..</a>.>=
;<br>
<div class=3D"im">> "<br>
><br>
> btw .. the queryPerRow you specify, performs multiple queries - one fo=
r<br>
> each row in your input data. Is that what you want ? Sounds like you w=
ant<br>
> to give one single query and get multiple answers...<br>
><br>
> bruce<br>
><br>
</div><div class=3D"im">> On 8 May 2012 14:21, Will Hanschell <<a hre=
f=3D"mailto:will.hansch...@gmail.com">will.hansch...@gmail.com</a>> wrot=
e:<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> > Hello all.<br>
><br>
> > I'm trying to add the Klout API to the restlibrary and am hav=
ing some<br>
> > difficulty. I think this is because the API's URL is a differ=
ent<br>
> > structure to all those in the library already. Whereas with exist=
ing<br>
> > URLs, the query (in this case a Twitter screenName) is simply app=
ended<br>
> > to the end of the URL when making the API call, with this URL the=
<br>
> > query needs to be inserted into the middle of the URL as the &quo=
t;key"<br>
> > must be placed after it. (see below)<br>
><br>
> > Here's my library:<br>
><br>
> > =A0 =A0 =A0 =A0With .add("klout id")<br>
> > =A0 =A0 =A0 =A0 =A0 =A0.add "restType", erQueryPerRow<b=
r>
> > =A0 =A0 =A0 =A0 =A0 =A0.add "url", "<a href=3D"htt=
p://api.klout.com/v2/identity.json/twitter" target=3D"_blank">http://api.kl=
out.com/v2/identity.json/twitter</a>?<br>
</div>> > screenName=3Dxxxxx&key=3Dxxxxx<<a href=3D"http://api=
.klout.com/v2/identity.json/twitter?%0AscreenName=3Dxxxxx&key.." target=
=3D"_blank">http://api.klout.com/v2/identity.json/twitter?%0AscreenName=3Dx=
xxxx&key..</a>.><br>
<div class=3D"HOEnZb"><div class=3D"h5">> > "<br>
> > =A0 =A0 =A0 =A0 =A0 =A0.add "id"<br>
> > =A0 =A0 =A0 =A0 =A0 =A0.add "treeSearch", True<br>
> > =A0 =A0 =A0 =A0 =A0 =A0.add "ignore", vbNullString<br>
> > =A0 =A0 =A0 =A0End With<br>
><br>
> > I think that this whole issue is handled later on in the library =
- in<br>
> > the restquery function. Somewhere here:<br>
><br>
> > =A0Set cr =3D New cRest<br>
> > =A0 =A0' lets get the data<br>
> > =A0 =A0If (sheetName <> vbNullString) Then<br>
> > =A0 =A0 =A0 =A0Set dSet =3D New cDataSet<br>
> > =A0 =A0 =A0 =A0With dSet.populateData(wholeSheet(sheetName), ,<br=
>
> > sheetName, , , , True)<br>
> > =A0 =A0 =A0 =A0 =A0 =A0' ensure that the query column exists =
if it was asked for<br>
> > =A0 =A0 =A0 =A0 =A0 =A0If qType =3D erQueryPerRow Then<br>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0If Not .headingRow.validate(True, =
sQueryColumn) Then<br>
> > Exit Function<br>
> > =A0 =A0 =A0 =A0 =A0 =A0End If<br>
> > =A0 =A0 =A0 =A0 =A0 =A0' alsmost there<br>
> > =A0 =A0 =A0 =A0 =A0 =A0Set cr =3D cr.init(sResults,<br>
> > qType, .headingRow.exists(sQueryColumn), _<br>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0, dSet, bPopulate, sUrl, b=
ClearMissing, _<br>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bTreeSearch, complain, sIg=
nore)<br>
> > =A0 =A0 =A0 =A0End With<br>
><br>
> > Does anybody have any ideas on this? Many hours so far and still<=
br>
> > scratching my head.<br>
><br>
> > Thanks!<br>
><br>
> > Will<br>
><br>
> > --<br>
> > You received this message because you are subscribed to the Googl=
e Groups<br>
> > "Excel Ramblings" group.<br>
> > To post to this group, send email to <a href=3D"mailto:excel-ramb=
lings@googlegroups.com">excel-ramblings@googlegroups.com</a>.<br>
> > To unsubscribe from this group, send email to<br>
> > <a href=3D"mailto:excel-ramblings%2Bunsubscribe@googlegroups.com"=
>excel-ramblings+unsubscribe@googlegroups.com</a>.<br>
> > For more options, visit this group at<br>
> ><a href=3D"http://groups.google.com/group/excel-ramblings?hl=3Den"=
target=3D"_blank">http://groups.google.com/group/excel-ramblings?hl=3Den</=
a>.<br>
<br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;Excel Ramblings" group.<br>
To post to this group, send email to <a href=3D"mailto:excel-ramblings@goog=
legroups.com">excel-ramblings@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:excel-rambl=
ings%2Bunsubscribe@googlegroups.com">excel-ramblings+unsubscribe@googlegrou=
ps.com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/excel-ramblings?hl=3Den" target=3D"_blank">http://groups.google.com/gr=
oup/excel-ramblings?hl=3Den</a>.<br>
<br>
</div></div></blockquote></div><br>
--e89a8f3ba5512ee94b04bf9c0851--