Mandatory variables are required
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2023 04:06 AM - edited ‎08-28-2023 04:08 AM
Hello all, While using POST in API to raise a catalog via rest api... It's giving me this error Message : mandatory variables are required But I have filled all the variables in the request body but still I'm getting this error.. Please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2023 04:16 AM - edited ‎08-28-2023 04:19 AM
Hi David,
I have got these 2 links for your reference please do check if this answers your issue.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790938
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0684628
Mark this as helpful and accepted solution if it helped you..
Thanks,
Shriram
BR,
Shriram Joshi
---------------------------------------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2023 04:22 AM
Hi @David Cross ,
Here are some steps you can take to troubleshoot and resolve the problem:
Check Variable Names: Ensure that the variable names in your request body match the exact variable names defined in the catalog item. Even a slight difference in the variable names can cause this error.
Check Variable Values: Double-check that you have provided values for all the mandatory variables in your request body. If any mandatory variables are missing values, you will encounter this error.
Variable Data Type: Verify that the data types of the values you are sending in the request match the expected data types of the variables in the catalog item. For example, if a variable is expecting a number, make sure you are sending a number in the request.
Nested Variables: If your catalog item includes nested variables (variables within variables), ensure that you are correctly structuring the JSON in the request body to represent the nested structure.
Catalog Item Configuration: Check the catalog item configuration in ServiceNow. Make sure that the variables are correctly defined as mandatory or optional based on your requirements.
Permissions: Ensure that the user making the API request has the necessary permissions to create catalog items and access the variables.
Special Characters: If your variable values contain special characters, make sure they are properly escaped in the JSON request body.
Request Format: Verify that your POST request is correctly formatted as JSON and that the headers indicate the content type as "application/json."
Payload Structure: Ensure that you are sending the payload in the correct structure. The payload should be a JSON object with a "variables" field containing the variable names and their corresponding values.
Debugging: Use tools like Postman or cURL to make the API request. These tools provide detailed error messages that can help identify the exact issue.
Thanks,
Ratnakar
