-
Notifications
You must be signed in to change notification settings - Fork 4
Media
Jason edited this page Mar 1, 2016
·
3 revisions
Media is a generic model for containing media. By default a simple url is provided for linking. The Image type extends Media to provide Image upload functionality.
Media must be attached to a mission and contain a title and url.
'{"url":"a_url", "title":"title", "mission_id":1}'Images can be uploaded to the cloud by providing the image data in the url field in a multipart post.
curl -X POST \
-H "Authorization: Token token=exploreapollo" \
-F "type=Image" \
-F "url=@NASA_logo.png" \
-F "title=the title" \
-F "mission_id=1" \
$SERVER/api/mediaOnce the media is loaded it can be attached to a channel. media_attachable_type is the type of object the media is being linked to, and media_attachable_id it id. Attachable types are: Moment Channel
Link Media item with id 1 with Channel with id 3
'{"media_id": 1, "media_attachable_type": "Channel", "media_attachable_id": 1}'