Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using web APIs -TweetPhoto.

Options
  • 06-11-2009 7:31am
    #1
    Registered Users Posts: 2,234 ✭✭✭


    Hi,

    I'm trying to develop a small app to upload to TweetPhoto using the API with Visual Basic.

    I'm not really to sure about how to use this. I ama aware that I need to setup a WebRequest object then setup headers etc but i'm getting lost along the way.

    Does anybody know of any tutorials on how to use these Web APIs with VB?

    I'm not having much luck with Google as I don't really know what to look for. What is the proper name for a web API like this? Web Service??


Comments

  • Registered Users Posts: 2,781 ✭✭✭amen


    which version of VB are you using ?
    .Net or VB6 ?


  • Registered Users Posts: 2,234 ✭✭✭techguy


    I'm using VB.NET 3.5

    I found out that TweetPhoto uses the REST web service protocol but have yet to find a decent gudie on this.

    My main problems are serializing the image to a byte array then streaming the data along with headers to the tweetphoto site.

    Has anybody done anything like this before?


  • Registered Users Posts: 1,916 ✭✭✭ronivek


    I can't really help you with the VB stuff but a RESTful web service is pretty straightforward to interact with.

    Basically in this case you're using HTTP methods to interact with the web service; GET to read a resource, POST to create a resource, PUT to update a resource and so on.

    I'm sure there must be some sort of VB library that'll provide the HTTP methods for you; so all you need to do is create the HTTP request and fire it off. All the information on the format of the request should be provided in the documentation for the TweetPhoto API in terms of any headers you need to set etc.

    A Java implementation example would be;
    HTTPRequest request = HTTPClient.createRequest("http://tweetphotoapi.com/api/tpapi.svc/upload2");
    request.setMethod("POST");
    request.setHeader("TPAPIKEY", "someKey");
    request.setContentType("application/x-www-form-urlencoded");
    request.setContentLength(imageFile.getLength());
    request.setBody(imageFile.getBytes());
    

    That's just to give you a vague idea of how you'd go about creating a HTTP request to add a photo using that API. You'll just need a HTTP library and some kind of File I/O (or preferably a specific Image File I/O library) and it shouldn't be too difficult.

    Here's a decent article that might help with the HTTP end of things.


  • Registered Users Posts: 2,234 ✭✭✭techguy


    ronivek wrote: »
    _

    Cool, you make it look pretty easy.

    I just found that yahoo link too.. it's pretty useful and easy to read.

    Thanks for all your help!!


Advertisement