Table Of Contents
File Resource Operations
Get Information about a File
Upload a File
Delete a File
File Resource Operations
This chapter describes the Cisco WebEx Social API File resource operations. These operations let you upload to Cisco WebEx Social server a text or binary file (which you can later embed in or attach to a post), obtain information about these files, and delete these files from the Cisco WebEx Social server.
Table 10-1 provides a summary of the File resource operations. Each operation is described in detail in the section that is listed.
These sections provide this information:
•
Purpose—Brief explanation of the operation
•
Availability—Cisco WebEx Social releases that support the operation
•
Request—HTTP method and URI for the operation
•
Request Payload—Description of the request payload, if the operation requires one
•
Response—Description of the expected response when the operation executes
•
Examples—Sample requests and responses for the operation
Table 10-1 File Resource Operations Summary
Operation and Reference
|
Purpose
|
Get Information about a File
|
Retrieves information about the designated file
|
Upload a File
|
Uploads to the Cisco WebEx Social server the image to be embedded in a post or the file to be attached to a post or micropost
|
Delete a File
|
Deletes the designated file from the Cisco WebEx Social server
|
Get Information about a File
Purpose
Retrieves information about the designated file.
Availability
Cisco WebEx Social 3.0 and later.
Request
HTTP Method
|
URI
|
GET
|
http://server[:port_number]/api/quad/rest/files/file_id
|
where:
•
server—Host name or IP address of the Cisco WebEx Social server.
•
port_number—Port number on which the Cisco WebEx Social server listens for API requests. The default value is 80.
•
file_id—Identifier of the file for which to retrieve information. For information about obtaining the identifier that you need, see the "Identifiers of Cisco WebEx Social Entities" section.
Request Payload
A request payload is not required.
Response
Standard response (see the "API Responses" section) with a response payload that can include one File resource (the "File Resource" section describes this resource). XML and JSON formats are supported.
XML Example
Request
GET http://webexsocialserver/api/quad/rest/files/3344
Response
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:response xmlns:ns2="http://quad.cisco.com/ns/1.0/xml">
<statusCode>200</statusCode>
<startIndex>0</startIndex>
<itemsPerPage>1</itemsPerPage>
<totalResults>0</totalResults>
<filtered>false</filtered>
<published>1319750745775</published>
<updated>1319750745775</updated>
<fileName>322675-retro-apple-tv.jpg</fileName>
<mimeType>IMAGE</mimeType>
<uri>/image/image_gallery?img_id=2310113&attachmentId=2310109</uri>
JSON Example
Request
GET http://webexsocialserver/api/quad/rest/files/3344
Response
Content-Type: application/json
"published": 1319750716168,
"updated": 1319750716168,
"fileName": "322675-retro-apple-tv.jpg",
"uri": "/image/image_gallery?img_id=2310104&attachmentId=2310100"
Upload a File
Purpose
Uploads to the Cisco WebEx Social server the image to be embedded in a post or the file to be attached to a post or a micropost.
Availability
Cisco WebEx Social 3.0 and later.
Request
HTTP Method
|
URI
|
POST
|
http://server[:port_number]/api/quad/rest/files[?fileName=filname]
|
where:
•
server—Host name or IP address of the Cisco WebEx Social server.
•
port_number—Port number on which the Cisco WebEx Social server listens for API requests. The default value is 80.
•
filname—Name of a file that overrides the file that is specified in the request payload.
The fileName parameter is required if you are using Internet Explorer to send this API operation.
Request Payload
File to be uploaded.
The HTTP Content-Type header must be multipart/form-data for this request. The form-data key must be specified as file=file_to_upload. If you are uploading a video file, single-sign on (SSO) must be enabled in Cisco WebEx Social before you execute this operation.
Response
Standard response (see the "API Responses" section) with a response payload that can include one File resource (the "File Resource" section describes this resource). XML and JSON formats are supported.
XML Example
Request
POST http://quadserver]/api/api/quad/rest/files
content-type: multipart/form-data; boundary=----------------------------02a4bb521c19
------------------------------02a4bb521c19
Content-Disposition: form-data; name="file"; filename="ProfilePhoto.jpg"
Response
Location: http://webexsocialserver/api/quad/rest/files/2310109
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:response xmlns:ns2="http://quad.cisco.com/ns/1.0/xml">
<statusCode>200</statusCode>
<startIndex>0</startIndex>
<itemsPerPage>1</itemsPerPage>
<totalResults>0</totalResults>
<filtered>false</filtered>
<published>1319750745775</published>
<updated>1319750745775</updated>
<fileName>ProfilePhoto.jpg</fileName>
<mimeType>IMAGE</mimeType>
<uri>/image/image_gallery?img_id=2310113&attachmentId=2310109</uri>
JSON Example
Request
POST http://quadserver]/api/api/quad/rest/files
content-type: multipart/form-data; boundary=----------------------------02a4bb521c19
------------------------------02a4bb521c19
Content-Disposition: form-data; name="file"; filename="ProfilePhoto.jpg"
Response
Location: http://webexsocialserver/api/quad/rest/files/2310109
Content-Type: application/json
"published": 1319750716168,
"updated": 1319750716168,
"fileName": "ProfilePhoto.jpg",
"uri": "/image/image_gallery?img_id=2310104&attachmentId=2310100"
Delete a File
Purpose
Deletes the designated file from the Cisco WebEx Social server. The file also is deleted from the posts that it is attached to or embedded in.
Availability
Cisco WebEx Social 3.0 and later.
Request
HTTP Method
|
URI
|
DELETE
|
http://server[:port_number]/api/quad/rest/files/file_id
|
where:
•
server—Host name or IP address of the Cisco WebEx Social server.
•
port_number—Port number on which the Cisco WebEx Social server listens for API requests. The default value is 80.
•
file_id—Identifier of the file to delete. For information about obtaining the identifier that you need, see the "Identifiers of Cisco WebEx Social Entities" section.
Request Payload
A request payload is not required.
Response
Standard response (see the "API Responses" section) with an HTTP header only.
Example
Request
DELETE http://webexsocialserver/api/quad/rest/files/455
Response