Which collection contains configuration_script_id?


#1

Trying to create a catalog item via the REST api.

I sent this request:

{
	"action": "create",
	"resources": [
		{
			"config_info": {
				"provision": {
					"dialog_id": "1000000000003",
					"fqname": "/AutomationManagement/AnsibleTower/Service/Provisioning/StateMachines/Provision/CatalogItemInitialization",
					"manager_id": "1000000000012"
				}
			},
			"description": "test catalog item",
			"display": true,
			"long_description": "long description with possibly html fancy stuff",
			"name": "test",
			"options": {},
			"prov_type": "generic_ansible_tower",
			"service_template_catalog_id": "1000000000001",
			"service_type": "atomic",
			"type": "ServiceTemplateAnsibleTower"
		}
	]
}

Got this back:

"error": {
	"kind": "bad_request",
	"klass": "Api::BadRequestError",
	"message": "Could not create Service Template - Must provide configuration_script_id or configuration"
}

Tried passing ID’s from /api/configuration_script_sources and /api/configuration_script_payloads

Got these errors making me think the id’s are not correct:

"Could not create Service Template - Couldn't find ConfigurationScript with 'id'=1000000000010 [WHERE \"configuration_scripts\".\"type\" IN ('ConfigurationScript', 'ManageIQ::Providers::AutomationManager::ConfigurationScript', 'ManageIQ::Providers::ExternalAutomat
ionManager::ConfigurationScript', 'ManageIQ::Providers::EmbeddedAutomationManager::ConfigurationScript', 'ManageIQ::Providers::AnsibleTower::AutomationManager::ConfigurationScript', 'ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScript')]"

The create action appears to be completely undocumented so I am flying blind and would love an a-ha moment from somebody in the know.


#2

Also when I crawl through the database I see the script ID i need and hardcoding it in my rest code allows the catalog item to be created. However this is not useful as I want to be able to get the script ID via the rest API.

vmdb_production=# select id,name from configuration_scripts where type = 'ManageIQ::Providers::AnsibleTower::AutomationManager::ConfigurationScript';
      id       |        name
---------------+--------------------
 1000000000074 | myTestScript