POST questions

3 views
Skip to first unread message

Mike M

unread,
May 5, 2009, 9:12:52 PM5/5/09
to Brightkite API
I'm writing a client in C#, and I'm currently coding the create and
update methods for the various objects.

My first question, which I will likely be testing by trial and error
later tonight, is how do I encode pictures for upload? My initial
attempt is going to involve a raw write of the image's bytes to the
request stream after writing the bytes for "photo[photo]=".

My second question stems from the first. photo[photo] is a required
field for a photo object, according to the docs. If I only wish to
update the body of the object, does the picture need to be resent as
part of the put, or is the requirement for the photo[photo] field
limited to create/POST operations?

And finally, all the examples I see are of curl calls, using the class
[property]=value format to POST new objects. Is this the only format
accepted, or can the XML representation of the object be used
instead? (The multiple return formats made me wonder.)

Thanks,

--Mike

mt1...@earthlink.net

unread,
May 6, 2009, 6:11:01 PM5/6/09
to brightk...@googlegroups.com
Mike you have the wrong email address. I am not a teck person and dont
work for BrightKite sorry.

Alex Wright

unread,
May 6, 2009, 9:14:08 PM5/6/09
to Brightkite API

mt1.. you must be subscribed to the BrightKite REST API Mailing list,
we all got a copy.

Mike: I've been working on a c# app that implements certain BK
functionality, but not picture uploading (yet). I'd be glad to help
any way I can if you run into any other difficulty.

Mike M

unread,
May 14, 2009, 5:09:08 PM5/14/09
to Brightkite API
Thanks Alex,

No luck, so far. I can post notes without any problems, but images
are still eluding me.

I'm converting the posted data to byte[], then writing them to the
request stream. I've tried converting and writing "photo[photo]=",
followed by a write of the raw bytes of the image, with no luck. I've
also tried converting the image's byte[] to UTF-8, appending to the
"photo[photo]=" string, and converting/writing the whole thing back.
I've tried converting the image to UTF-8, Url Encoding it, and then
writing the whole thing back. No luck there, either.

I may try posting a multi-part form next, but it would really help is
someone, whether from the BrightKite team or the community, could
clarify the form of encoding that should be used. I like figuring
things out, but I could be spending this energy on features and
testing.

Thanks,

--Mike
> > work for BrightKite sorry.- Hide quoted text -
>
> - Show quoted text -

Mike M

unread,
May 14, 2009, 7:00:41 PM5/14/09
to Brightkite API
OK, I haven't had the chance to work this out in C#, but using curl to
play with it a little, I find that it requires a multi-part form,
which makes the curl parameters different than those of note, and most
of the others.

So, the example in the API reference should have something like this
for Photos:

curl -X POST -u login:pw -F photo[photo]=@filename
http://brightkite.com/places/356a192b7913b04c54574d18c28d46e6395428ab/photos.xml

--Mike
> > - Show quoted text -- Hide quoted text -

Daryl

unread,
May 14, 2009, 9:08:17 PM5/14/09
to brightk...@googlegroups.com
We have mobipicture.nl with a lot of success here with photo uploading - maybe we could connect and share API's 

2009/5/15 Mike M <mike.m...@gmail.com>
Reply all
Reply to author
Forward
0 new messages