How to insert record via REST API to RITM table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 09:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 09:20 PM
I followed the steps proved by @Ankur but it leads me to different output. Instead of a response that the Request Item has been created. It gives me the cart id only, I used the Buy Item (POST) API, please see response i get.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 09:20 PM
Hi @mark141230 . Take a look at OOB Catalog API
Example: to pass variables
var obj = {
"sysparm_quantity": 1, // add 1 quantity
"description": current.getValue('description'),
"short_description": current.getValue('short_description'),
//pass variable data
'variables': {
'requestor': '6816f79cc0a8016401c5a33be04be441',
'email': 'abc@gmail.com',
'test': 'test'
}
};
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 09:23 PM
Hello @mark141230 ,
To insert a record via a REST API into a ServiceNow RITM (Request Item) table, you'll need to follow these general steps:
1. **Authentication**: Ensure you have the necessary authentication credentials to access the ServiceNow instance via the REST API. This typically involves using OAuth tokens, Basic Authentication, or API keys. Consult your ServiceNow instance's documentation for specific authentication details.
2. **Endpoint URL**: Determine the endpoint URL for the ServiceNow table you want to insert records into. In this case, for the RITM table, it might look something like:
https://your-instance.service-now.com/api/now/table/<table_name>
Replace <table_name> with the actual name of the RITM table in your instance.
3. **HTTP Request**: Send an HTTP POST request to the endpoint URL with the record data you want to insert. You'll typically send this request with JSON data in the request body.
Example POST request using curl:
bash
curl -X POST "https://your-instance.service-now.com/api/now/table/<table_name>" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_access_token>" \
-d '{
"short_description": "Sample RITM",
"description": "This is a test RITM record."
}'
Ensure you replace <your_access_token> with your actual authentication token.
4. **Handle Response**: After making the POST request, you should receive a response from the ServiceNow API. Typically, a successful insertion will result in a 201 Created status code along with the newly created record details in the response body.
You can parse this response to confirm that the record was successfully inserted.
Please note that the exact details and authentication methods may vary depending on your specific ServiceNow instance and its configuration.
Refer to below link for the most accurate and up-to-date information on using its REST API.
Please mark my answer correct or helpful, if applicable.
Thanks & Regards,
Chaitali Vale