<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Attachment API Invalid file type issue in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/3006370#M1134812</link>
    <description>&lt;P&gt;Hi &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/121514"&gt;@Kris Moncada&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I was not able to resolve this issue.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2024 13:40:48 GMT</pubDate>
    <dc:creator>bota</dc:creator>
    <dc:date>2024-08-01T13:40:48Z</dc:date>
    <item>
      <title>Attachment API Invalid file type issue</title>
      <link>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/2848998#M1090576</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to attach excel file using attachment API and i am getting&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Invalid file type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet error. I only get this error when trying to do this using a third-party tool, that requires me to write the payload in js. And only when i am trying to send excel files i tried to upload pdf the same way and it works. Here's my code:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;===============================================================&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;SPAN&gt; options = {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; method: &lt;/SPAN&gt;&lt;SPAN&gt;'POST'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; url: &lt;/SPAN&gt;&lt;SPAN&gt;'attachment/file?table_name=my_table&amp;amp;table_sys_id='&lt;/SPAN&gt;&lt;SPAN&gt; + sys_id + &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;amp;file_name='&lt;/SPAN&gt;&lt;SPAN&gt; + filename,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; responseType: &lt;/SPAN&gt;&lt;SPAN&gt;'json'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; resolveBodyOnly: &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; metadataType: irpa_core.enums.request.metadataType.formData,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; headers: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Content-Type'&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Accept'&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'*/*'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; },&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; body: content&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; options;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;===============================================================&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I don't have any problem calling it via thunder client with the same payload:&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bota_0-1709545354220.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/335367i9EC825BB4BE4A5BE/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bota_0-1709545354220.png" alt="bota_0-1709545354220.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;Here's the CURL that works for the excel file:&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;curl &amp;nbsp;-X POST \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; 'https:&lt;/SPAN&gt;&lt;SPAN&gt;//myinstance.service-now.com/api/now/attachment/file?table_name=mytable&amp;amp;table_sys_id=mysysid&amp;amp;file_name=myfilename' \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; --header 'Accept: *&lt;/SPAN&gt;&lt;SPAN&gt;/*' \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; --header 'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; --header 'Authorization: Basic ' \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; --data-binary '@c:\myfile.xlsx'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Any idea why it works with this CURL and doesn't work with the js code above?&lt;/DIV&gt;&lt;DIV&gt;Thank you!&lt;/DIV&gt;&lt;DIV&gt;Bota&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Mar 2024 12:48:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/2848998#M1090576</guid>
      <dc:creator>bota</dc:creator>
      <dc:date>2024-03-04T12:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment API Invalid file type issue</title>
      <link>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/3005096#M1134456</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/680866"&gt;@bota&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you ever get this resolved? I'm running into a similar issue; but my code is server-side.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 14:37:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/3005096#M1134456</guid>
      <dc:creator>Kris Moncada</dc:creator>
      <dc:date>2024-07-31T14:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Attachment API Invalid file type issue</title>
      <link>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/3006370#M1134812</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/121514"&gt;@Kris Moncada&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I was not able to resolve this issue.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 13:40:48 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/attachment-api-invalid-file-type-issue/m-p/3006370#M1134812</guid>
      <dc:creator>bota</dc:creator>
      <dc:date>2024-08-01T13:40:48Z</dc:date>
    </item>
  </channel>
</rss>

