attached is the project file. It's an experiment so there needs to be a bit more work to make it function for everyone equaly but I'll explain what I did.
For what I'm trying to do with it I don't need OAuth as i don't need access to a particular user information. Most of Instagrams API also works with the client_id and client_secret.
- register an API with Instagram and get a client_id and client_secret
- set up the call back url to redirect to your computer
- I used duckdns.org, had to setup a router mapping to pass any requests to my computer and also ran into this old problem where Skype uses port 80 (port 80 being the default web port - but you can change that in Skypes advanced settings)
- In the attached file fill in client_id and client_secret as well as callback_url in the tables feeding the various web DATs.
- Now in the subscribe Web DAT, hit Submit. This will get Instagram to send a response to your specified callback_url and therefor the response ends up in the tcpip DAT
- Here I didn't do too much work, the tcpip DAT will parse the incoming text for Instagrams response. In their API doc they say to expect a message like this:
- Code: Select all
- now we need to send back the challenge so in the tcpip callback you can see how i parse out the challenge and send it back:
- Code: Select all
if message.startswith('GET /?hub.challenge'):
#must reply with challeng
challenge = message[20:52]+'\n'
- You might have to adjust the parsing depending on the response message from Instagram
- From this point on, Instagram is sending you a little json dictionary everytime a new post is made for your subscription. In the tcpip callbacks I'm just triggering the fetch parameter on the getRecentByTag webDat
Here is were it needs a bit of work:
- Parse out the Header information correctly
- Parse out the json dictionary correctly for the subscription updates so you can deal with multiple subscriptions
But the basics are in this and no external modules need to be installed
I saw that the streaming API for twitter could also work similar to this...
Very helpful while working on this was http://apigee.com/
Hope it helps