PDA

View Full Version : Meetup.com



Roel Westhoff [W4]
29-Aug-2015, 05:28 AM
1.
Got a request to connect DF to Meetup.com.
http://www.meetup.com/meetup_api/auth/#keysign

Pickup the Mailchimp.wo and changed it to MeetupTest.wo
Made changes to the web and normal properties

// Web properties
Set wpsOAuth2Url to "https://secure.meetup.com/oauth2/authorize"
Set wpsClientID to "r2i0dqjsu9pjn1okg88v4s8xxx"
Set wpsRedirectUrl to "http://localhost/OAuth2/OAuth2/Callback.html"
Set wpsResponseType to "code"

// Normal properties
Set psClientSecret to "7k2p0899qr6rirc7psvdboxxxx"
Set psTokenHost to "secure.meetup.com"
Set psTokenPath to "oauth2/access"

And logged in to Meetup.com with the access_token supplied by Meetup.com after signing-up to meetup.com.
The result was getting a timestamp (no error) from meetup.com (so far so good i think)

My problem is that i get an error message after adding
https://api.meetup.com/activity?&sign=true&photo-host=public (https://secure.meetup.com/meetup_api/console/?path=/activity)
to the operations field and executing

The error messages is: {"errors":[{"code":"not_authorized_host","message":"A valid host is required"}]}

I made one small change to the LIop procedure


Procedure LIOp
String sOp sVerb sResp sToken sPath sContent
Integer iOK

WebGet wpsAccessToken of oOAuth to sToken

If (sToken = "") Begin
Send ShowInfoBox "You need to log into Meetup before testing operations" "Error"
Procedure_Return
End

WebGet psValue of oOperation to sOp
WebGet psValue of oVerb to sVerb
WebGet psValue of oContent to sContent
Move (sOp) to sPath //<<<<<
WebSet psValue of oPath to sPath

Send ClearHeaders of oLIHttp
Send Reset of oLIHttp
Get AddHeader of oLIHttp "Authorization" ("Bearer" * sToken) to iOK

// The following two calls tell the Meetup API that you want to work in JSON rather than XML
Get AddHeader of oLIHttp "x-li-format" "json" to iOK
Get AddHeader of oLIHttp "Content-type" "application/json" to iOK

Get HttpVerbAddrRequest of oLIHttp sPath (AddressOf(sContent)) (Length(sContent)) False sVerb to iOK

If iOK Begin

If ((Left(sResp, Length(C_DOCTYPE) - 1) = C_DOCTYPE) or ;
(Left(sResp, Length(C_HTMLTAG)) = C_HTMLTAG)) Begin
WebSet pbRender of oResponseText to False
WebSet pbRender of oResponseHTML to True
WebSet psHtml of oResponseHTML to (psData(oLIHttp(Self)))
End
Else Begin
WebSet pbRender of oResponseText to True
WebSet pbRender of oResponseHTML to False
WebSet psValue of oResponseText to (psData(oLIHttp(Self)))
End

End

WebSet psValue of oRemains to (GrantLeft(oOAuth(Self)))
End_Procedure


Any idea what i'm doing wrong?

2. The different views show us to access external API's and receiving a result. What i'm missing in the examples is what to do with the received data.
At the presentation of oAuth2 in the netherlands i've seen some good examples. Can these examples be added to the beta?

Roel

Mike Peat
29-Aug-2015, 08:05 AM
Roel

First off, I think you modified the LinkedIn sample rather than the MailChimp one - some of its idiosyncrasies (especially the "x-li-format" HTTP Header) are visible in your code, as is its naming scheme.

Otherwise superficially your code looks good and what you say suggests it is working as far as the OAuth 2.0 aspect is concerned. I tried using your code, but suspect that you have (quite correctly!) changed the Client ID and Client Secret, so I couldn't get it to work (the sign-on screen got all grumpy with me) - when I have more time I will register my own app and try with that.

Until I do that, I can only suggest that the call you are making to the API may be in error - you have to get those exactly right. You seem to be using the "activity" operation, passing it "sign=true" and "photo-host=public" on the query string, while the doc (http://www.meetup.com/meetup_api/docs/activity/) seems to say that the appropriate parameters for that operation are "member_id" (which has to be the member you are authenticated as - presumably logged in as) and "page_start" which is a timestamp to return data from.

Mike

Mike Peat
29-Aug-2015, 08:13 AM
Roel

Yes, we are short of examples of what to do with the data (usually in JSON format) once you get it back. Part of this effort is aimed at showing developers how to use the various REST APIs, but so far all of my energies have gone into the OAuth 2.0 aspect (I'm struggling with OAuth 1.0a and may well give up on it as a bad job - need crypto keys and request signing, which is a pain).

I will try to post some stuff on the topic shortly, but it is a whole other ball-game really.

Mike

Roel Westhoff [W4]
30-Aug-2015, 07:38 AM
Mike,

As oAuth1.0a is superseded by OAuth2.0 i wouldn't put much effort in getting OAuth10a up and running.
Getting some ideas out to us how to use the various REST API results has more priority for me.

The availability of OAuth2 in Dataflex has triggered me to investigate the various platforms (linkedin, google) a lot closer.
Realising that with the introduction of the web framework and REST API my knowledge of Javascript and css is seriously lacking. I'm doing my best to do online training but Javascript is a lot trickier than Dataflex.
Knowledge of Javascript is necessary. The promise of Data access to build apps without understanding the innerworkings of javascript is, let me say this, optimistic.
It is possible but you will not be able to solve all problems.

The same goes for the incorporation of REST aPi results in Dataflex.
Unless some packages or examples will be supplied i think that the majority of the dataflex developers is over-asked to integrate the REST API data in dataflex.(me included).
Maybe Data Access could/should jump in here.

Roel

Mike Peat
30-Aug-2015, 11:39 AM
Roel

1: I have Meetup working. (I have not signed up to anything as a Meetup user, so what I get back is pretty dull, but it is clearly working: "dashboard" and "activity" operations return sensible JSON - see below). I am attaching the Web View I used to this post and hopefully you can just add it to your program to see it working. 9207 Use operations "activity" (no params) and "dashboard" (also no params) to see stuff happening. Further exploration of the Meetup API I leave to you. You may need to get your Meetup API key from here (https://secure.meetup.com/meetup_api/key/) for some (most?) requests - I'm not sure: I didn't need it for the two I tried.



Operation "dashboard (http://www.meetup.com/meetup_api/docs/dashboard/)" gets me: {"stats":{"city_top_groups":11,"global_top_groups":100,"nearby_events":864}}
Operation "activity (http://www.meetup.com/meetup_api/docs/activity/)" gets me: {"results":[],"meta":{"next":"","method":"ActivityFeed","total_count":0,"link":"https:\/\/api.meetup.com\/activity","count":0,"description":"","lon":"","title":"What's Happening for Mike Peat on Meetup.com","url":"https:\/\/api.meetup.com\/activity?format=json","id":"","updated":"Sun Aug 30 12:26:06 EDT 2015","lat":""}}


(I said it was dull! :))

2: OAuth 1.0a remains important because some providers (Xero, Twitter and quite possibly others) only support OAuth 1.0a at present (AFAIK - it may change), while others (Yahoo!) require it for some of their APIs (I suspect Yahoo! are migrating to OAuth 2.0 across the board, so this may change quite rapidly).

3: You should not need to know anything about JavaScript (or CSS come to that) to use the OAuth component to interact with REST APIs. You will need to be able to decode the JSON responses you get back (and indeed will need to be able to format data you send to them as JSON); in another strand I am working to help with that, however getting OAuth 2.0 fully working is my current priority.

Mike

Roel Westhoff [W4]
1-Sep-2015, 09:22 AM
Hello Mike,

Thanks for helping me out.

It looks like i wasn't aware what to put in the operation field.
'/2/categories' was apparently enough. Didn't know or try that.

I will take it from here.

Roel

Mike Peat
1-Sep-2015, 09:24 AM
Roel

Good to hear and happy to help! :D

Let us know here how you get on - that is a big part of what this forum is for.

Mike

Marco
29-Sep-2015, 12:51 AM
Hi Mike

The Meetup one gives a completely different experience as the Office 365.
I was able to use the baked in application code and secret, and could login without a problem.

I have not worked out how to use the content field properly, but if I just copy the complete request url (as per documentation https://secure.meetup.com/meetup_api/console/?path=/2/members) into the operation I get the data returned.

So. e.g. my meetup event in Sydney, if I put the following in the operation field:

2/members?&sign=true&photo-host=public&group_urlname=Sydney-Mobile-Cloud-Business-Application-Development-Meetup&page=200

I get the information of all 194 members :) very cool, as it includes all the other groups that each of these members are part of. Something that saves a LOT of clicking and is great for profiling!!!

So I guess my question:
- Is it normal that for GET questions you do not use the content field but just put all in the 'Operation' field?
- Perhaps a link to the Request URL 'builder' and the meetup API documentation, could be added your document.
- is it 'normal' that once the application is known to meetup (as you did that in this instance), that the developer does not need to redo the client_ID and secret, or am I using part of your credentials?

Keep up the great work!!!

Cheers
Marco

Mike Peat
29-Sep-2015, 02:39 AM
Marco

Yes - no content is ever sent by an HTTP GET AFAIK, except that passed in the URL and its query string (and possibly in custom HTTP headers, but let's no go there).
I thought I had put in a link to the Meetup API (http://www.meetup.com/meetup_api/) in that section (https://docs.google.com/document/d/14Kvk0C-vZXBrORh6IjlEzk63Z1KuYHQ3vL5CzpXHXmY/edit#heading=h.e5qvwmegmehl).
When you are using the sample application you are using my credentials at the program level (and so is everybody else); for your own program you will want to create your own.

Glad you like it! :)

Mike