To create a catalog source, you make a POST request with a project ID that has a cloud template version released to the project.
Prerequisites
- Verify that all general prerequisites have been satisfied. See Prerequisites for Requesting a Deployment from a Catalog Item.
Procedure
Example: Create a catalog source and list discovered items
Create a catalog source for a cloud template named BasicCloudMachine.
Assign variables.
$ url='https://appliance.domain.com'
$ api_version='2020-08-25'
$ project_id='394a4ccb-22c6-4ef0-8c75-8b77efbefb51'
List all available sources in your catalog.
$ curl -X GET \ $url/catalog/api/admin/sources?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
Examine the response to confirm that the name of the catalog source that you plan to create is not listed. The following snippet shows that you cannot create a catalog source with the name Catalog Source from Blueprintecho s.
... "id": "753d24a3-e2b0-4d5e-bba6-9e32e5964c69", "name": "Catalog Source from Blueprintecho s", ...
List all available catalog source types.
$ curl -X GET \ $url/catalog/api/types?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
Examine the response to find the ID for a VMware Cloud Templates source type.
... "id": "com.vmw.blueprint", "name": "VMW Cloud Template", "baseUri": "http://catalog-service:8000/catalog/api/provider/blueprint", "createdBy": "deploymentservice", ...
Assign the source type to the catalog item type variable.
$ catalog_type_id='com.vmw.blueprint'
Create a catalog source of the VMware Cloud Templates source type.
$ curl -X POST \ $url/catalog/api/admin/sources?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" \ -H "Content-Type: application/json" \ -d '{ "config":{ "sourceProjectId":"'$project_id'" }, "typeId":"'$catalog_type_id'", "name":"Catalog Source from VMware Cloud Templates" }' | jq "."
A snippet of the response shows the catalog source ID.
{
"id": "753d24a3-e2b0-4d5e-bba6-9e32e5964c69",
"name": "Catalog Source from VMware Cloud Templates",
"typeId": "com.vmw.blueprint",
"createdAt": "2021-11-08T22:02:33.553Z",
...
Assign the catalog source ID.
$ catalog_source_id='753d24a3-e2b0-4d5e-bba6-9e32e5964c69'
List items discovered in your project.
$ curl -X GET \ $url/catalog/api/admin/items?projectId=$project_id&apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows the catalog item ID with your cloud template name.
{ "id": "718917c0-1e02-3141-8142-11da5acaed8f", "name": "BasicCloudMachine", "description": "Basic Cloud Machine cloud template", "sourceId": "753d24a3-e2b0-4d5e-bba6-9e32e5964c69", ...
Assign the catalog item ID.
$ catalog_item_id='718917c0-1e02-3141-8142-11da5acaed8f'