I have to write an API Query to get all the opportunities, Quotes and its associated Attachments to another team that are outside salesforce in my office. Will they be able to download the Attachment-(queried with the help of API)?
From the additional information covered in the comments on the question:
- The "other team" does not have access to Salesforce (no licenses)
I'm assuming that the query will be performed by a program/script outside of Salesforce, using the REST API.
I'm also assuming that you (or your manager) already know how to use the REST API (including authenticating with Salesforce via one of the OAuth flows) to run a query against data stored in Salesforce.
With that information in hand, I can say that the answer to your question is no. You cannot download an attachment that you've retrieved from a query ...at least not directly.
Technically speaking, by getting a response from your query, you have downloaded the data from Salesforce. However, the result of your query will be a string in JSON format, and the actual data of your attachment (stored in the
Body field) is encoded as Base64. Both of these present obstacles in actually delivering the attachments (that is, you won't be able to simply send the data to a browser and have the 'save file' dialog box pop up).
For single attachments, you could look at using sObject Blob Retrieve. You should be able to extract the attachment Ids from your query. From there, you would run an additional API call for each of the attachment Ids. This method isn't exactly friendly for more than a couple of attachments.
With additional processing, you could feasibly take the base64 encoded attachment bodies and package them in a zip file that you would present to the user for download.
You also may be able to use the base64 encoded values as a data-uri, which you may be able to present on a more user-friendly web page for downloading. I haven't done this myself, and goes beyond the scope of this site, but this question on StackOverflow may get you started.
As long as the attachments are not marked private and they have view access to the record itself, then they would have access to the attachments.
By Attachment I am referring to anything that is in the Notes & Attachments Related List - not files.