To create a catalog source, you make a POST request with a project ID that has a cloud template version released to the project.

Because you are requesting the deployment of a cloud template from the catalog, this example lists the steps required to create a VMware Cloud Templates source type.

Prerequisites

Procedure

  1. Assign the project ID variable.
    project_id='<your_project_id>'
  2. List all your catalog sources.
    curl -X GET \
      $url/catalog/api/admin/sources?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
  3. Examine the response to confirm that the name of the catalog source that you plan to create is not listed.
  4. List all catalog source types.
    curl -X GET \
      $url/catalog/api/types?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
  5. Examine the response to find the catalog source type that you want to create.
  6. Assign the catalog item type ID variable for the VMware Cloud Templates source type.
    catalog_type_id='com.vmw.blueprint'
  7. Create a catalog source for your cloud template.
    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":"<your_catalog_source_name>"
    }' | jq "."
  8. To obtain the catalog source ID, examine the response.
  9. List all items discovered in the project.
    curl -X GET \
      $url/catalog/api/admin/items?projectId=$project_id&apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
  10. To obtain the catalog item ID, examine the response.
  11. (Optional) Assign the cloud template name variable.
    cloud_template_name='<your_cloud_template_name_that_was_released_to_catalog>'
  12. (Optional) To get the catalog item ID, you can also list discovered items by name.
    curl -X GET \
      $url/catalog/api/admin/items?projectId=$project_id&search=$cloud_template_name&apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."

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'

What to do next

You use the catalog_source_id to create entitlement for the catalog source. Or you can use the catalog_item_id to create entitlement for the cloud template item. See Create Entitlements.