30.03.2014 Views

Database.com Chatter REST API Developer's Guide - Salesforce.com

Database.com Chatter REST API Developer's Guide - Salesforce.com

Database.com Chatter REST API Developer's Guide - Salesforce.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Introducing <strong>Chatter</strong> <strong>REST</strong> <strong>API</strong><br />

Requesting Static Assets and Posting Forms Directly from<br />

HTML<br />

• Post form requests to <strong>Chatter</strong> <strong>API</strong> when files are attached, for example, feed items or <strong>com</strong>ments with a file attachment,<br />

or user profile photo updates.<br />

To request static assets or post form requests, request a resource that returns a bearer token URL. Then use the bearer token<br />

URL to request the resource.<br />

1. Request a resource with a response body property that contains a bearer token URL:<br />

• Photo—largePhotoUrl, smallPhotoUrl, url*<br />

• Feed Item Attachment-Dashboard—fullSizeImageUrl, thumbNailUrl<br />

• Comment Page—currentPageUrl*<br />

• Feed Item—photoUrl<br />

• Feed—feedItemsUrl*<br />

• Feed Item Attachment-Content—downloadUrl, renditionUrl<br />

• File Summary—downloadUrl, renditionUrl<br />

• File Detail—downloadUrl, renditionUrl<br />

*Use to POST or PUT for new items that include binary files: for example, a feed item or <strong>com</strong>ment with a file attachment.<br />

2. Pass the X-Connect-Bearer-Urls request header with a value of true:<br />

X-Connect-Bearer-Urls: true<br />

3. Parse the bearer token URL from the response body and use it in an HTML tag to request a static asset or to post a form<br />

request.<br />

Bearer token URLs have the following characteristics:<br />

• The bearer token is good for the given URL only. Adding or reordering query parameters invalidates the URL.<br />

• The bearer token has a time-to-live (TTL) of 20 minutes. If the token expires you must request it again.<br />

• The request to the bearer token URL authenticates as the user who requested the resource that returned the bearer<br />

token URL.<br />

23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!