Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Catalog API is not working

SANDEEP28
Mega Sage

Hi All,

 

I created test catalog item to create request using Service Catalog API. I am using "Buy Item(POST)" method in REST API explorer. But its giving me below error. Can anyone help here

 

{
  "error": {
    "message": "com.glide.rest.domain.ServiceException: Exception while reading request",
    "detail": ""
  },
  "status": "failure"

}

 

SANDEEP28_0-1728235456249.png

 

Paylod:

 

{
'sysparm_id': 'f59b3f0e9709121080e4b390f053af49',
'sysparm_quantity': '1',
'variables':{
'car_name': nexon'
}
}

 

There is only one variable in this catalog item

 

SANDEEP28_1-1728235564591.png

 

 

 

1 ACCEPTED SOLUTION

Bhavya11
Kilo Patron
Kilo Patron

hi @SANDEEP28 ,

 

pass below payload in raw

Bhavya11_0-1728273359403.png

 

 

{
'sysparm_id': 'f59b3f0e9709121080e4b390f053af49',
'sysparm_quantity': '1',
'variables':{
'car_name': 'nexon'
}
}

 

try to execute once again.

 

 

Thanks,

BK

View solution in original post

4 REPLIES 4

Bhavya11
Kilo Patron
Kilo Patron

hi @SANDEEP28 ,

 

pass below payload in raw

Bhavya11_0-1728273359403.png

 

 

{
'sysparm_id': 'f59b3f0e9709121080e4b390f053af49',
'sysparm_quantity': '1',
'variables':{
'car_name': 'nexon'
}
}

 

try to execute once again.

 

 

Thanks,

BK

Amit Verma
Kilo Patron
Kilo Patron

Hi @SANDEEP28 

 

As per the payload shared by you, you have missed a ' before nexon. Please try with below payload and see if it works :

{
'sysparm_id': 'f59b3f0e9709121080e4b390f053af49',
'sysparm_quantity': '1',
'variables':{
'car_name': 'nexon'
}
}

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Community Alums
Not applicable

Hi @SANDEEP28 ,

There is just a little error in payload please correct it as below

Paylod:

 

{
'sysparm_id': 'f59b3f0e9709121080e4b390f053af49',
'sysparm_quantity': '1',
'variables':{
'car_name': 'nexon'
}
}

 

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Jitendra Diwak1
Kilo Sage

Hi @SANDEEP28,

 

Mostly in this scenario, we get the error in payload. To validate the payload, you can use this site below:

https://jsonlint.com/

 

And there is minor issue in your payload:

{
'sysparm_id': 'f59b3f0e9709121080e4b390f053af49',
'sysparm_quantity': '1',
'variables':{
'car_name': 'nexon'
}
}

 

Please accept my solution if it works for you and thumps up.

 

Thanks

Jitendra

 

Please accept my solution if it works for and thumps up.