We want to get attachment BLOB data using the standard salesforce API. See the API Docs link below. ([https://developer.salesforce.com/docs/api-explorer/sobject/Attachment/get-attachment-id])
We are using salesforce as a backend and we have a requirement where we have to get the attachment body using community user login by calling Salesforce standard Sobject API (API Details are provided in the above link). We are passing authorization/access token of the community user to get the attachment data.The token is working for custom web services.
We tried through postman application also but we are getting 404 error. I am giving the complete details below which I have used for the Postman.
Salesforce URL - https://community_URL/services/data/v46.0/sobjects/Attachment/AttachmentId
Headers:
[{"key":"Content-Type","value":"application/json; charset=utf-8","description":""}]
[{"key":"crossDomain","value":"true","description":""}]
[{"key":"Authorization","value":"Bearer Generated_Access_Token","description":""}]
After calling the Salesforce API from Postman/JavaScript, we are getting following reponse.
[ { "errorCode": "NOT_FOUND", "message": "The requested resource does not exist" } ]
I have checked the community setting where we checked "Let customer users access notes and attachments" settings to allow community user to access.
We have Public read/write sharing setting for the object where we have added attachment.
If we call same (sObject) URL from workbench then we are getting the prorper response. Even, when we tried to call that API through postman using admin "Access Token" then it is returning the result.
There might be some security setting missing. Please help me to solve this. Thanks in advance