Error in get attachment from deal

Hi team,
While trying to fetch document from freshsale.deal it shows unsupported contenttype tried with - application/json and without content type all but it throws error sample code

  try {
async function uploadFromS3File(options, formData, attachmentList) {

    // Using Axios for making HTTP requests
    console.log("attachment url : ", options.url)
    console.log("attachment options : ", options)

    var fsaToken = await fetchFsaToken();
    let  headers ={
      Authorization: "Token token=" + fsaToken,
    }
    await client.request.get(options.url, { headers: headers ,encoding: null }).then(
      function (data) {
        let attachmentResponse = JSON.parse(data.response);
        console.log("attachmentResponse : ", attachmentResponse.data)
        formData.append("attachments[]", new Blob([attachmentResponse.data]));
       
        attachmentList.push(options.name)
        return options.name
      })
      .catch(function (error) {
        console.error("Error fetching attachment:", error);
      });



calling function :


 var options = { url: sofAttachmentUrl, name: sofFileName, dealId: dealDataValue['DealID']};
    const s3Resp = await uploadFromS3File(options, formData, attachmentList)
    console.log("s3Resp : ", s3Resp)

Is there anything to be changed?

Hey @Deiviya_Sivacoumar,

From the error, looks like you don’t have access or the wrong authentication key is used for the API. Can you re-check that?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.