Creation of req/req_item/tasks via api

Marcio9
Tera Expert

I was wondering if there was a way to create requests/request item/sc_task from the current catalog items via an API. The ones i checked on the developer servicenow api site don't create requests, and some just return 404 statuses. I tried using pysnow but it is mainly for reading and writing the incident table, it can't create request_items/tasks inside the request table. I also tried the servicenow API but it only shows you about checking out and not creating requests. Can anyone point me in the correct direction?

1 ACCEPTED SOLUTION

Soeren Maucher
Mega Sage

There is the Service Catalog API for this use case. You can find it in the REST API Exlporer in the Namespace sn_sc:
find_real_file.png

If you want to create a Requested Item directly with a corresponding Request without using the cart and checkout you could for instance directly use the "Buy Item" endpoint.
find_real_file.png

View solution in original post

3 REPLIES 3

Soeren Maucher
Mega Sage

There is the Service Catalog API for this use case. You can find it in the REST API Exlporer in the Namespace sn_sc:
find_real_file.png

If you want to create a Requested Item directly with a corresponding Request without using the cart and checkout you could for instance directly use the "Buy Item" endpoint.
find_real_file.png

Marcio9
Tera Expert

For some reason it doesn't work on most of the catalog items, it just gives a 500 error and the response body is:

{
  "error": {
    "message": "",
    "detail": ""
  },
  "status": "failure"
}

Marcio9
Tera Expert

I figured it out, some the of required or mandatory fields expect a reference/object and not a string, so I gave the mandatory variables sys_ids instead of strings and it works now.