I am trying to fetch Salesforce attachment body using standard REST API /services/data/v50.0/sobjects/Attachment/<record-id>/body
from an external tool.
This API call returns me the data in below format which seems to be application/octetstream (as read in postman content-type response header).
Once this data is fetched, I need to use the same file and attach it to another record in Salesforce. However, while using the standard REST API to create an attachment record,it expects the data in base64 format. What is the way by which I can convert this incoming data into base64 format and then upload attachment to another record? Or is there any other way by which I can fetch the data in a different format itself?