Importing products

Cloud API has endpoints that let you import a product. The source of the product can be either an XML template or a mind map.

Use the following endpoint to import a product:

  • POST /productdefinition/v1/import-template
  • POST /productdefinition/v1/import-xmind

For most Cloud API endpoints, the request has a body with a single string of JSON text. However, the import endpoints expect the request body to be a FormData object, as opposed to a JSON string. The request header must have a content key whose value is the template or mind map to import. The response contains a body with a single id attribute that identifies the id of the imported product.

Example of importing an XML template

For example, suppose you had an XML template for a PersonalAuto product. The template is named PA-20230516.xml. The following request imports the template.

Command

POST /productdefinition/v1/import-template

Request header

content/PA-20230516.xml

Request body

{
    "data": {
        "attributes": {
            "id": "PersonalAuto"
        }
    }
}

Example of importing a mind map

For example, suppose you had a mind map for a MarineCargo product. The template is named MarineCargo.xmind. The following request imports the mind map.

Command

POST /productdefinition/v1/import-xmind

Request header

content/MarineCargo.xmind

Request body

{
    "data": {
        "attributes": {
            "id": "MarineCargo"
        }
    }
}

Import XML templates and mind maps using Postman

About this task

From Postman, you can POST XML templates and mind maps using FormData objects.

Procedure

  1. In Postman, start a new request by clicking the + to the right of the Launchpad tab.
  2. Under the Untitled Request label, select POST.
  3. In the Enter request URL field, enter the URL for the server and the endpoint. For example:
    1. To POST an XML template to an instance of PolicyCenter on your machine, enter: http://localhost:8180/pc/rest/productdefinition/v1/import-template
    2. To POST a mind map to an instance of PolicyCenter on your machine, enter: http://localhost:8180/pc/rest/productdefinition/v1/import-xmind
  4. On the Authorization tab, specify authorization information as appropriate.
  5. Specify the request payload.
    1. In the first row of tabs (the one that starts with Params), click Body.
    2. In the row of radio buttons, select form-data.
    3. On the first line, for KEY, enter: content
    4. Click outside of the content cell. Then, mouse over the right side of the cell. A drop-down list appears. Change the value from Text to File.
    5. For VALUE, click the Select Files button and navigate to XML product file or mind map file.
  6. Click Send. The response payload appears below the request payload.