Skip to content

Commit 45a3fcd

Browse files
Create README.md
This readme file has info about how to Automate Catalog Item Creation with a Single REST Call.
1 parent aba90d6 commit 45a3fcd

File tree

1 file changed

+99
-0
lines changed
  • Integration/Scripted REST Api/Create Catalog Item Dynamically

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# ServiceNow Catalog Builder API
2+
**Automate Catalog Item Creation with a Single REST Call**
3+
4+
---
5+
6+
## Overview
7+
8+
The **ServiceNow Catalog Builder API** is a custom **Scripted REST API** that dynamically creates Service Catalog Items in your instance — including variables and choices — from a simple JSON payload.
9+
10+
This API eliminates the repetitive manual work of configuring Catalog Items one by one, and makes it possible to **automate catalog creation programmatically** or **integrate it with CI/CD pipelines, GitHub workflows, or external systems**.
11+
12+
---
13+
14+
## Key Features
15+
16+
Automatically create **Catalog Items** in `sc_cat_item`
17+
Dynamically generate **Variables** and **Choices**
18+
Supports **category mapping** and **item ownership**
19+
Extensible design for **flows, icons, and attachments**
20+
Developer-friendly — fully JSON-driven
21+
22+
---
23+
24+
## Use Case
25+
26+
This API is perfect for:
27+
- **Admin Automation:** Auto-build standard catalog forms during environment setup.
28+
- **RPA / CI Pipelines:** Integrate with DevOps or GitHub Actions to deploy catalog definitions.
29+
- **Dynamic Service Portals:** Allow external apps or portals to create items on demand.
30+
31+
Example:
32+
A company wants to auto-create 10 new service catalog items from a GitHub configuration file.
33+
Using this API, they simply call one REST endpoint for each definition — no manual clicks needed.
34+
35+
---
36+
37+
## ⚙️ Scripted REST API Details
38+
39+
| Property | Value |
40+
|-----------|--------|
41+
| **Name** | Catalog Builder API |
42+
| **API ID** | `x_demo.catalog_creator` |
43+
| **Resource Path** | `/create` |
44+
| **Method** | POST |
45+
| **Authentication** | Basic Auth / OAuth |
46+
| **Tables Used** | `sc_cat_item`, `item_option_new`, `question_choice` |
47+
48+
---
49+
50+
## Logic Flow
51+
52+
1. **Receive JSON input** with item name, category, and variables.
53+
2. **Create a new record** in `sc_cat_item`.
54+
3. **Loop through variables** and create them in `item_option_new`.
55+
4. If the variable type is `select_box`, create **choices** automatically.
56+
5. Return a JSON response with the new item’s `sys_id` and success message.
57+
58+
---
59+
60+
## 🧾 Example Input (POST Body)
61+
62+
```json
63+
{
64+
"name": "Request New Laptop",
65+
"category": "Hardware",
66+
"short_description": "Laptop provisioning request form",
67+
"description": "Allows employees to request a new laptop with model and RAM options.",
68+
"owner": "admin",
69+
"variables": [
70+
{
71+
"name": "Laptop Model",
72+
"type": "select_box",
73+
"choices": "Dell,HP,Lenovo"
74+
},
75+
{
76+
"name": "RAM Size",
77+
"type": "select_box",
78+
"choices": "8GB,16GB,32GB"
79+
},
80+
{
81+
"name": "Business Justification",
82+
"type": "multi_line_text"
83+
}
84+
]
85+
}
86+
87+
88+
Example Output:
89+
{
90+
"catalog_sys_id": "b2f6329cdb6d0010355b5fb4ca9619e2",
91+
"message": "Catalog item created successfully!"
92+
}
93+
After the API call:
94+
A new Catalog Item appears under Maintain Items.
95+
The item contains:
96+
Short Description: Laptop provisioning form
97+
Variables: Laptop Model, RAM Size, Business Justification
98+
Choices: Auto-populated for select boxes
99+
The item is active and ready to use in the catalog.

0 commit comments

Comments
 (0)