Skip to tutorial content
Rate module 5.0/5 (1)

The Service Catalog API

4 min read
On this page

In this lesson, you will learn:

  • Why systems order from the catalog
  • The order_now call
  • Who the API runs as
  • How to test it in REST API Explorer

πŸ” Quick look back: Last time: Fulfilling Catalog Tasks in the Workspace. You learned how Desktop Support works a catalog task in the workspace and keeps the requester updated.

1 “HR already knows who’s joining”

SNWR’s HR system has every new joiner’s details.

  • Managers type the same details into SNWR New joiner.
  • Sometimes they forget to order at all.
  • The new joiner arrives with no laptop.

🎯 The problem: Typing the same data twice is slow and gets missed.

πŸ‘‰ The fix: let the HR system place the order itself, through the Service Catalog API.

2 How the API works

Key term: API

A way for one system to ask another to do something, without a person clicking.

Key term: Service Catalog API

ServiceNow’s API for ordering catalog items, just like a person would.

Key term: Integration user

A user account for a system, not a person. It can only use the API.

Ordering through the Service Catalog API. 1 The HR system sends a POST request to /api/sn_sc/servicecatalog/items/{sys_id}/order_now as the user snwr.hr.integration. 2 The body gives the quantity and the variables, like Requested for and keyboard layout. 3 ServiceNow creates a REQ and RITM, and the normal flow, approvals and tasks run. 4 The reply gives back the new request number.
Figure 1. HR orders. The normal flow does the rest.

3 Safe setup

  • Create an integration user, snwr.hr.integration, with web service access only ticked.
  • Give it only the roles it needs.
  • The API follows user criteria, so this user must be able to see the item.

πŸ“ Note: For an order guide like SNWR New joiner, the API has a separate call named submit_guide. Test the single item first.

πŸ’‘ Good to know: Need a refresher? See Fundamentals β€Ί Integration Basics β€Ί REST API Explorer.

4 Let’s try it: order through the API

  1. Find the sys_id of SNWR New laptop (right-click the item’s header and copy sys_id).
  2. Open System Web Services β€Ί REST β€Ί REST API Explorer. Namespace sn_sc, API Service Catalog API.
  3. Pick Order Now. Paste the sys_id. In the body, set sysparm_quantity to 1 and add the variables, like requested_for.
  4. Send it. Read the reply and find the new request number.
  5. Open the request. Check the RITM and its flow are running like a normal order.

5 Quick recap

  • An API lets systems order without a person
  • The call is order_now on the item’s sys_id
  • Run it as an integration user with web service access only
  • The normal flow, approvals and tasks still run
  • Test in REST API Explorer first

6 Check yourself

Think of your answer first. Then tap to check.

1 Which call orders a single item? Show answer

POST …/servicecatalog/items/{sys_id}/order_now.

2 Who does the HR system run as? Show answer

An integration user, snwr.hr.integration.

3 Does the normal flow run for an API order? Show answer

Yes. It’s just like a person ordering.

4 The integration user can’t see the item. Why? Show answer

User criteria hide it from that user.

Nice work! SNWR’s HR system can now order for new joiners. πŸŽ‰
Next up: Integrating Fulfillment with Other Systems

Was this lesson helpful?

Have a question or doubt?

Ask here and get help from instructors and fellow learners.

0 / 300

Only logged-in learners can post.