Cisco WebEx Social API Reference Guide, Release 3.0
File Resource Operations
Downloads: This chapterpdf (PDF - 121.0KB) The complete bookPDF (PDF - 14.42MB) | Feedback

File Resource Operations

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

Cisco WebEx Social server port number that is used for communication with the API consumer. Must be provided if the port number is not 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
Accept:application/xml

Response

HTTP/1.1 200 OK
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>
  <sorted>false</sorted>
  <entry>
    <attachment>
      <id>3344</id>
      <resource/>
      <size>27571</size>
      <published>1319750745775</published>
      <updated>1319750745775</updated>
      <fileName>322675-retro-apple-tv.jpg</fileName>
      <mimeType>IMAGE</mimeType>
      <uri>/image/image_gallery?img_id=2310113&amp;attachmentId=2310109</uri>
    </attachment>
  </entry>
</ns2:response>

JSON Example

Request

GET http://webexsocialserver/api/quad/rest/files/3344
Accept:application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json
{
    "statusCode": 200, 
    "startIndex": 0, 
    "itemsPerPage": 1, 
    "totalResults": 0,
    "filtered": false, 
    "sorted": false, 
    "entry": [
        {
            "data": {
                "id": 3344, 
                "resource": "", 
                "size": 27571, 
                "published": 1319750716168, 
                "updated": 1319750716168, 
                "fileName": "322675-retro-apple-tv.jpg", 
                "mimeType": "IMAGE", 
                "author": null, 
                "uri": "/image/image_gallery?img_id=2310104&attachmentId=2310100"
            }
        }
    ], 
    "serverMessages": null
}

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

Cisco WebEx Social server port number that is used for communication with the API consumer. Must be provided if the port number is not 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
accept: application/xml
content-length: 87899
 
   
expect: 100-continue
 
   
content-type: multipart/form-data; boundary=----------------------------02a4bb521c19
------------------------------02a4bb521c19
Content-Disposition: form-data; name="file"; filename="ProfilePhoto.jpg"
<binary_file>

Response

HTTP/1.1 201 Created
Location: http://webexsocialserver/api/quad/rest/files/2310109
Content-Length: 597
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>
  <sorted>false</sorted>
  <entry>
    <attachment>
      <id>3344</id>
      <resource/>
      <size>27571</size>
      <published>1319750745775</published>
      <updated>1319750745775</updated>
      <fileName>ProfilePhoto.jpg</fileName>
      <mimeType>IMAGE</mimeType>
      <uri>/image/image_gallery?img_id=2310113&amp;attachmentId=2310109</uri>
    </attachment>
  </entry>
</ns2:response>

JSON Example

Request

POST http://quadserver]/api/api/quad/rest/files
accept: application/json
content-length: 87899
 
   
expect: 100-continue
content-type: multipart/form-data; boundary=----------------------------02a4bb521c19
------------------------------02a4bb521c19
Content-Disposition: form-data; name="file"; filename="ProfilePhoto.jpg"
<binary_file>

Response

HTTP/1.1 201 Created
Location: http://webexsocialserver/api/quad/rest/files/2310109
Content-Length: 597
Content-Type: application/json
HTTP/1.1 200 OK
{
    "statusCode": 200, 
    "startIndex": 0, 
    "itemsPerPage": 1, 
    "totalResults": 0,
    "filtered": false, 
    "sorted": false, 
    "entry": [
        {
            "data": {
                "id": 3344, 
                "resource": "", 
                "size": 27571, 
                "published": 1319750716168, 
                "updated": 1319750716168, 
                "fileName": "ProfilePhoto.jpg", 
                "mimeType": "IMAGE", 
                "author": null, 
                "uri": "/image/image_gallery?img_id=2310104&attachmentId=2310100"
            }
        }
    ], 
    "serverMessages": null
}

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

Cisco WebEx Social server port number that is used for communication with the API consumer. Must be provided if the port number is not 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

HTTP/1.1 204 No Content