Attachment API for 3rd Party REST API Service Catalog API

_Samay
Tera Expert

Dear Team,

Good day, hope you all are doing good.

Needed your help in one of the use cases – We have exposed Service Catalog API for some record producers on HRSD. So, LeenaAI Application can utilize those REST API with payload and create HR cases into ServiceNow.

But we can not pass attachments from those Service Catalog API’s and We want to pass attachments as well while hitting REST APIs to create HR cases for different HR Services.

Please let us know like how we can pass attachments from APIs while submitting HR cases or is there any other way to make this?

Thanks,

 

2 REPLIES 2

Tanushree Maiti
Mega Patron

Hi @_Samay 

 

If you create scripted rest api, at a time ,you can do both the steps as per your defined logic.

 

If you want to stick to OOB API ,you have to go through 2 steps as per your requirement.

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

pavani_paluri
Kilo Sage

Hi @_Samay ,

 

You’ve exposed Service Catalog APIs so LeenaAI can submit HR cases via record producers.
These APIs handle the payload for case creation, but attachments aren’t supported directly in the catalog submission call.


That’s why you can’t pass files along with the initial request.

How to include attachments
There are two common approaches:

1. Use the Attachment API (sys_attachment):
First, call the Service Catalog API to create the HR case.
Then, use the Attachment REST API (`/api/now/attachment`) to upload files and associate them with the newly created case record.
You’ll need the `sys_id` of the case created in step 1 to link the attachment.

2. Custom wrapper flow/API:
Build a Flow Designer or Scripted REST API that accepts both the case payload and attachments in one request.
Behind the scenes, it creates the HR case and then calls the attachment API to add the files.
This gives LeenaAI a single endpoint to hit, but requires some configuration work.

Don’t try to push attachments through the catalog API directly — it’s not designed for that.


Instead, chain the calls:
1. Create the case via Service Catalog API.
2. Upload attachments via the Attachment API, referencing the case `sys_id`.
If you want simplicity for the consuming app (LeenaAI), wrap both steps in a custom API or flow.

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P