{"error":{"message":"Invalid file type: image/jpeg","detail":null},"status":"failure"}

KadenV
Giga Contributor

Getting an error with Invalid File Type when using the Attachment API for Posting an attachment to an INC that is already created: 
https://developer.servicenow.com/dev.do#!/reference/api/yokohama/rest/c_AttachmentAPI#attachment-POS...

I pass in "image/jpeg" as the content-type and receiving the error above. Not sure if I am doing something wrong with the content-type. Any help would be appreciated! thank you! 

10 REPLIES 10

Shivalika
Mega Sage
Mega Sage

Hello @KadenV 

 

Can you share screenshot if what you have passed in the REST API Explorer?

 

You can also checkout this video for Attachment API IN rest API EXplorer -

https://youtu.be/VqCxt1vSvIE?si=SMQBDTfc2jSE-Jz5

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

Welcome to @ServicenowDeveloperr channel. This video covers @servicenow #inbound #integration . I am talking about lesser used APIs in REST API Explorer which can make day to day work easier. This video contains demonstration of #Attachment #API with 6 requirements implementation. Follow me on ...

Shivalika
Mega Sage
Mega Sage

Hello @KadenV 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE

Ankur Bawiskar
Tera Patron
Tera Patron

@KadenV 

please share the complete details on how are you sending the image data?

Things to check

1) Are you sure you uploaded image only since you gave content type - image/jpeg

2) Are you sure file type image/jpeg is allowed on incident table?

share some screenshots of your REST API Explorer

Without this members can't help much.

It worked for me, check below

AnkurBawiskar_0-1743999488455.png

 

AnkurBawiskar_1-1743999518694.png

 

AnkurBawiskar_2-1743999561586.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

KadenV
Giga Contributor

Screenshot 2025-04-07 114012.pngScreenshot 2025-04-07 114036.png

 

The Screenshot 2025-04-07 114103.png