How to pass attachment when submitting a catalog item form web page using REST API?

Bharath
Tera Contributor

I am using scripted REST API to create RITM.

 

 

This is the JSON object to pass the variables to create a catalog item. 

{
'sysparm_quantity': 1,
'variables': {
'title' : 'test titile',
'phone_number' : '99044444a2',
'type' : 'new',
'approvaluser' : '7a8929983b9c445052ca655593efc440',
'request_for' : '7a8929983b9c445052ca655593efc440',
'email':'x',
'website' : 'https://www.google.com/'
}
}

 

 

 

BUT HOW DO I PASS ATTACHMENT WHEN A REQUEST IS SUBMITTED FROM A WEB PAGE.

2 REPLIES 2

DrewW
Mega Sage
Mega Sage

Once you make the call to order/create the request you should have the sys_id of the request so you will then have to use the attachment API to add the attachment.

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/rest/c_AttachmentAPI

 

Bharath
Tera Contributor

Hi @DrewW ,

 

"Once you make the call to order/create the request you should have the sys_id of the request so you will then have to use the attachment API to add the attachment."   ---> I have done this. I am able to create RITM and alll. But how do I receive the attachment and how to do I put it into the newly created RITM.