-
Notifications
You must be signed in to change notification settings - Fork 333
Post an image
evanp edited this page Dec 31, 2012
·
1 revision
Posting an image requires two steps.
POST the image to the user's uploads stream (for user fred
, it's at /api/user/fred/uploads
). The Content-Type
should be the right content-type for the file (like image/gif
or image/png
). The data should be raw binary data for the file.
POST /api/user/fred/uploads HTTP/1.1
Host: pump.example
Content-Type: image/jpeg
Content-Length: 128443
AF^&%$LK*...
The results will be an ActivityStrea.ms representation of the object, in JSON.
200 OK
Content-Type: application/json
{
"id": "https://pump.example/api/image/Xkdk_ffK1dkf2",
"objectType": "image",
"image": {
"url": "https://pump.example/uploads/2012/12/30/ZFxf-3.jpg"
}
"fullImage": {
"url": "https://pump.example/uploads/2012/12/30/ZFxf-3.jpg"
}
}
Use the JSON results of the upload step to create a "post" Activity Streams activity and POST it to the user's feed (for user fred
, it's /api/user/fred/feed
).
{
"verb": "post",
"object": {
"id": "https://pump.example/api/image/Xkdk_ffK1dkf2",
"objectType": "image"
}
}