- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 05:44 AM - edited 10-09-2024 05:46 AM
Hi,
I am using POST method for Buy Item:
https://xxxx.service-now.com/api/sn_sc/servicecatalog/items/{sys_id}/order_now
and testing via postman. Below is the json I am passing via postman:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 06:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 12:00 AM
Hello @Shivani29 ,
The error you're seeing suggests that the quantity field is being passed incorrectly. For the REST API request to work properly, the quantity field should be sent as an integer, not as a string.
Here are two options you can try:
-
Send quantity as an integer:
{ "quantity": 1, "variables": { "Variable1": "value", "variable2": "value", "variable3": "value" } } -
Use sysparm_quantity instead of quantity:
{ "sysparm_quantity": 1, "variables": { "Variable1": "value", "variable2": "value", "variable3": "value" } }
Either approach should resolve the "Invalid Quantity value" error. Let me know if you encounter any other issues!
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Regards,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 06:29 AM
Hi @Shivani29
Instead of quantity could you please use sysparm_quantity
See below -
Please mark my answer as correct and helpful if it works for you.
Regards
Moin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 06:42 AM
Hi @Shivani29
Ensure that the quantity field is being sent as an integer rather than a string. You can modify your JSON to
{
"quantity": 1,
"variables": {
"Variable1": "value",
"variable2": "value",
"variable3": "value"
}
}I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 12:00 AM
Hello @Shivani29 ,
The error you're seeing suggests that the quantity field is being passed incorrectly. For the REST API request to work properly, the quantity field should be sent as an integer, not as a string.
Here are two options you can try:
-
Send quantity as an integer:
{ "quantity": 1, "variables": { "Variable1": "value", "variable2": "value", "variable3": "value" } } -
Use sysparm_quantity instead of quantity:
{ "sysparm_quantity": 1, "variables": { "Variable1": "value", "variable2": "value", "variable3": "value" } }
Either approach should resolve the "Invalid Quantity value" error. Let me know if you encounter any other issues!
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Regards,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 01:11 AM
Hi @Shivani29
In ServiceNow's REST API, the quantity might need to be passed as an integer instead of a string. Try removing the quotes around the quantity value, like this:
{
"quantity": 1,
"variables": {
"Variable1": "value",
"variable2": "value",
"variable3": "value"
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 02:55 AM
Hi @Shivani29
Replace quantity by sysparm_quantity should do the trick.
Invalid quantity value: Indicates that either the sysparm_quantity parameter is not provided or contains an invalid value.
Ref: ServiceNow Catalog API - Invalid quantity value
Cheers,
Tai Vu