Send attachment through rest API - Binary request

RamyaMunukutla
Kilo Contributor

Hello, 

 

I'm new to the service now platform so looking for suggestions to solve the issue that we're facing. The use case is to create a service now ticket with an attachment when a user fills out a form in salesforce. 

When the user attaches a pdf file to the form in salesforce, the service now ticket gets created but the attachment shows up as a file instead of pdf. 

I've been having issues with the attachment API. I would like to use POST method (binary request)... When I use the Rest Api explorer in service now, it works well but doesnt work otherwise. 

We create an external service in salesforce using the request and response body from the rest api explorer. 

 

Any help will be appreciated. 

Thanks, 

Ramya

1 REPLY 1

Ahmmed Ali
Mega Sage

Hello @RamyaMunukutla 

 

Attachment data would be little tricky to handle in APIs. You can consider inbound email to create ticket in ServiceNow from salesforce. Salesforce can send an email to ServiceNow with attachment, and in ServiceNow, inbound action can be configured to create required ticket. Here, the attachment will be automatically copied to target ticket created.

 

Thanks,

Ali

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali