Attachments

GET /api/users/:user_id/attachments
paginated list of attachments for a group or user

Success Response Code: 200

Additional Routes

  • (GET) fetch attachments for group - /api/groups/:group_id/attachments

Params

Param name Description
user_id
optional

user you want to see attachments for


Value: Must be a Integer
group_id
optional

group you want to see attachments for


Value: Must be a Integer
page
optional

page number of attachments to be returned (default=1)


Value: Must be a Integer
per_page
optional

number of attachments to be returned per page (default=20, max=500)


Value: Must be a Integer

Response Fields

attachments array of attachment entries Array<Attachment>
id id for this attachment Integer
filename name of the attachment String
url url for accessing the attachment String
public_filename url for downloading the file content String
file_extension extention for the attachment file String
content_type mime content typeof the attached file String
external_host_type name of the external host for the attachment String

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/users/26/attachments.json
curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/groups/2/attachments.json

POST /api/attachments
create an attachment - limit 100MB. Requires Content-Type: multipart/form-data. Administrator can decrease the maxmimum attachment size

Success Response Code: 201

Params

Param name Description
attachment
required

attachment file data to upload


Value: Must be a File

Response Fields

id id for this attachment Integer
filename name of the attachment String
url url for accessing the attachment String
public_filename url for downloading the file content String
file_extension extention for the attachment file String
content_type mime content typeof the attached file String
external_host_type name of the external host for the attachment String

Example Curl Commands

curl -X POST -F "attachment=@./path/to/file" -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/attachments.json

GET /api/attachments/:attachment_id
redirect to attachment

Success Response Code: 302

Params

Param name Description
attachment_id
optional

attachment record's identifier


Value: Must be a Integer
thumbnail
optional

size of the thumbnail to retrieve. Valid values: original, stream, stream_square, square45, scaled480. Default: original


Value: Must be a String

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/attachments/112

GET /api/attachments/:attachment_id/:thumbnail/:filename
retrieve the contents of an Attachment

Success Response Code: 200

Params

Param name Description
attachment_id
optional

attachment record's identifer


Value: Must be a Integer
thumbnail
optional

size of the thumbnail to retrieve. Valid values: original, stream, stream_square, square45, scaled480. Use “original” for the original file.


Value: Must be a String
filename
optional

filename to retrieve


Value: Must be a String

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/attachments/112/original/image.jpg

DELETE /api/attachments/:attachment_id
destroy an attachment

Success Response Code: 200

Params

Param name Description
attachment_id
optional

the attachment record's identifier


Value: Must be a Integer

Example Curl Commands

curl -X DELETE -v --basic -u "emily@socialcast.com:demo" https://demo.socialcast.com/api/attachments/112