tags:

views:

40

answers:

1

The documentation of the API shows source code on how to accomplish this in Python:

#!/usr/bin/python

import pycurl

c = pycurl.Curl()
values = [
          ("key", "YOUR_API_KEY"),
          ("image", (c.FORM_FILE, "file.png"))]
# OR:     ("image", "http://example.com/example.jpg"))]

c.setopt(c.URL, "http://imgur.com/api/upload.xml")
c.setopt(c.HTTPPOST, values)

c.perform()
c.close()

I'd like a bit of guidance on how to do this in C#. For instance, I'm lost on what these "values" would be in C#, how would I even declare them?

I'm not familiar with cURL at all, so that might be holding me back from translating a bit.

Help me Obi-wan. You're my only hope. /click

+1  A: 

You just need to perform an HTTP POST, e.g. this code with a "parameters" string of key=YOUR_API_KEY&image=http://example.com/example.jpg or the like.

Alex Martelli
I'm a bit confused do you literally put that string as the method's parameter?
Sergio Tapia
`dopost(@"http://foo.bar", @"key=YOUR_API_KEY-).
Alex Martelli