We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › twitpic using their api in processing
Page Index Toggle Pages: 1
twitpic using their api in processing (Read 5642 times)
twitpic using their api in processing
Nov 10th, 2009, 2:17pm
 
So saw info on the twitter api, and I have twitter4j working really well.  Now I want to also utilize that in conjunction with the twitpic api.  That is located here:
h tt p : //  twitpic.com / api.do#uploadAndPost

(my first post had to spread the link out).

its a simple POST METHOD I think (not a web coder by any means) and I am not sure how one would do that in processing.  I did get a JSON jar up and running in processing in case I have to use that...  but I think it should even be simpler than that, anyone can point me in the right direction?

Thanks,
Shane
Re: twitpic using their api in processing
Reply #1 - Nov 11th, 2009, 1:45am
 
Look at the postToWeb library (listed in the library page): it shows how to convert an image to include it in a POST request.
Re: twitpic using their api in processing
Reply #2 - Nov 11th, 2009, 4:14pm
 
great I will check this out...I am guessing that is where i include the method for the post as well as the arguments?
Re: twitpic using their api in processing
Reply #3 - Nov 11th, 2009, 4:56pm
 
I must be slow.  I got the postToWeb and well it seems to not like the URL I gave it for the twitpic.  according to the api, i need the message, and user name and password.  So I did this:
Code:
void keyPressed()
{
 String url = "http:/grrractivelinkerrorinforum/twitpic.com/api/uploadAndPost?username=mytweetname&password=mypass&media=";

 if(key == 'j'){
   ImageToWeb img = new ImageToWeb(this);
   img.save("jpg",true);
   img.post("test",url,"jpg-test",true,img.getBytes(g));
 }

}


It does make it to the twitpic api server thing, but always returns a:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="fail">
<err code="1001" msg="Invalid twitter username or password" />
</rsp>


I am guessing that the extra arguments to img.post are messing up my post string.  I wish this was simpler.

Thanks, Shane
(and the image I am wanting to send will be from a Capture device , i.e. web cam)...


Any help here to get me over the hump?

Re: twitpic using their api in processing
Reply #4 - Nov 12th, 2009, 2:11am
 
I pointed to the library but I don't think you can use it out of the box, the idea was to rip out the image conversion and POST message building from there and to built your own POST message, which, IIRC, must include user name and password. Ie. these information must be in a multi-part POST message, not in the GET part of the URL.
Re: twitpic using their api in processing
Reply #5 - Nov 12th, 2009, 9:45am
 
OMG Im a dork, I just realized the source was included in that.  I will hack on this.  Thanks!  (Gotta figure out how to hack the source and build a jar processing can use)  But good stuff thanks for the link regardless...

Shane
Re: twitpic using their api in processing
Reply #6 - Nov 12th, 2009, 2:03pm
 
I was so close yet so far away, finally broke down to ask some java pros:

http:/ /forums.sun.com/forum.jspa?forumID=536&start=0

though I did figure out how to get the library template and all that working for processing in eclipse IDE.  It is really cool!

Shane
Re: twitpic using their api in processing
Reply #7 - Nov 12th, 2009, 2:17pm
 
I suppose you mean the thread Networking - So close to properly formatting this POST request to twitpic api..
Shouldn't you put \r\n after the values
Re: twitpic using their api in processing
Reply #8 - Nov 12th, 2009, 2:27pm
 
If you figured out how to upload some Screens to twitpic let me know. This is something I maybe need to in the future Smiley keep on working Wink !
Re: twitpic using their api in processing
Reply #9 - Nov 12th, 2009, 2:38pm
 
I plan on releasing this library as soon as I can.  Learned a lot already on building libraries for Processing.  Good stuff...good stuff.
Re: twitpic using their api in processing
Reply #10 - Nov 12th, 2009, 2:48pm
 
God a second set of eyes helps.  I didn't even realize that.  That seems to of gotten it!  All I have to do now is read some processing docs on how to load a pic for it to twit.  And gotta read how to go about releasing this simple to use library!

thanks PhiLho!  That did it!

Figuring out how to go about releasing the library now...
Re: twitpic using their api in processing
Reply #11 - Nov 12th, 2009, 2:51pm
 
had a hard time understanding your post Wink but i am looking forward to test the library
Re: twitpic using their api in processing
Reply #12 - Jun 6th, 2010, 9:01pm
 
Did anyone ever figure this out?
Page Index Toggle Pages: 1