rbw / aiosnow

Asynchronous ServiceNow Library
MIT License
73 stars 12 forks source link

Add support for catalog requests #89

Open gforster opened 3 years ago

gforster commented 3 years ago

Requesting a way into an api for submitting a form to a catalog request and kicking off the REQ/RITM/SCTASK. There seems to have to do with glide records rather than tables like incidents, change records, cmdb, etc.

manvillej commented 3 years ago

catalog item API is SIGNIFICANTLY different from the Table API. Both the process and data architecture are complicated which makes it much more challenging to implement. There are 24 API resources and all of them would have to be implemented to get to full functionality.

The process for it is so divergent from the table model that a separate project might be better. It could use this project as a dependency, but implementing it as part of this project might just mess up all of the nice clean logic of Table API.

https://developer.servicenow.com/dev.do#!/reference/api/paris/rest/c_ServiceCatalogAPI

rbw commented 3 years ago

Good points @manvillej, thanks.

aiosnow was designed to support multiple APIs, I think this can be implemented cleanly. I've created an investigation task and associated with this issue. You'll be notified when there's an update.

gforster commented 3 years ago

@rbw I'm positive you've been quite busy, just wondering if you've had any luck on the investigation side

rbw commented 3 years ago

There are 5 APIs that need to be mapped. Should be fairly easy if we build on top of aiosnow.models.table.BaseTableModel.

It would be great if someone can help out creating schemas. We need one for each API, including nested items, such as _cart.recurringfrequency.

Visit this URL for an example: https://developer.servicenow.com/dev.do#!/reference/api/quebec/rest/c_ServiceCatalogAPI#servicecat-GET-cart

...and scroll down to "Response body parameters (JSON or XML)" -- that's an example of what needs to be mapped into an aiosnow model-schema.

Here's an example of the IncidentModelSchema: https://aiosnow.readthedocs.io/en/latest/_modules/aiosnow/models/table/declared/incident.html#IncidentModelSchema

When it comes to naming, I suggest:

When those have been created, I'll start working on implementing the models, which should be fairly straightforward - unless I've overlooked something.

I'll probably expose "sub APIs" (ServiceCatalogCartModel etc) via ServiceCatalogModel, to make things convenient.

I've created the service-catalog-api branch, let me know if you want to help out with this and I'll make you a collaborator.