4

If a chatter file has been shared then SalesForce creates a URL which is public. How can I get that URL using REST APIs but not chatter APIs? I want to do so because quota of chatter API calls is far less per user per hour and I want to get URLs of large number files which are public.

  • I haven't fully checked it yet, but can you use the ContentDistribution API and DistributionPublicUrl field? I'm not sure if it is only for Content, or it it extends to Chatter as well. – Daniel Ballinger Dec 15 '15 at 22:32
  • 1
    Great. If you have any content to add to the answer let me know. I.e. the SOQL query you are using. This will help the next person who encounters it. – Daniel Ballinger Dec 16 '15 at 18:27
  • I have used to following SOQL to get public URL of the required ContentDocument: /services/data/v32.0/query/?q=SELECT+Id,ContentDocumentId,DistributionPublicUrl,LastModifiedDate+FROM+ContentDistribution+WHERE+ContentDocumentId='XXXXXXXXXXXXXXXXXX' – Zeeshan Zahid Dec 17 '15 at 12:28
2

As per the comments, try using the ContentDistribution API and the corresponding DistributionPublicUrl field.

Use to following SOQL to get public URL of the required ContentDocument:

/services/data/v32.0/query/?q=SELECT+Id,ContentDocumentId,DistributionPublicUrl,‌​LastModifiedDate+FROM+ContentDistribution+WHERE+ContentDocumentId='069XXXXXXXXXXX‌​XXXX'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.