How to use REST API explorer to submit an existing Service Catalog Item and pass a value into a variable on the RITM?

Jeff316
Kilo Guru

HI All,

I'm using the REST API explorer to submit an existing Service Catalog Request. 

For this, on the REST API Explorer GUI:  I chose the "Service Catalog API" and "BUY Item (Post)"

I pass the sys_id of the existing Service Catalog Item that I want to open, along with sysparm_quantity = 1

I click SEND and it works perfectly. The catalog item opens, the REQ, the RITM and the WF on that item fires.

Now I have 1 variable on that catalog item called my_variable.

In the API Explorer, how do I pass a value into my_variable?

I have tried several syntax suggested by users  but none have worked. 

This was the last attempt to pass the word "testing" into the RITM variable called my_variable.

When I send, I get 404 Not Found "Invalid Request"

Am I using the right API to submit a catalog request and at the same time passing a variable?

This perfectly opens the catalog item, just can't pass a value to the variable on this catalog item.

 

{"sysparm_quantity":"1","variables":"{my_variable:testing}"}

find_real_file.png

find_real_file.png

 

 

 

1 ACCEPTED SOLUTION

Instead of using builder, please select raw tab and use the below body

{
   "sysparm_quantity":"1",
   "variables":{
      "my_testing":"testing"
   }
}

View solution in original post

5 REPLIES 5

dvp
Mega Sage
Mega Sage

Submit  your variable value in quotes

as "testing"

No luck.

I added the quotes but still the same error.

Added my screen shots below.

 

find_real_file.png

 

 

find_real_file.png

Instead of using builder, please select raw tab and use the below body

{
   "sysparm_quantity":"1",
   "variables":{
      "my_testing":"testing"
   }
}

I cannot thank you enough.

This has been driving me crazy all day.

I've been trying every syntax possible.

Adding the syntax as RAW worked.

Thanks.

{
   "sysparm_quantity":"1",
   "variables":{
      "my_variable":"testing"
   }
}