Exporting and importing dataflows using REST API

Learn how to export and import dataflows using the REST API and Swagger in Cloudera Edge Management.

In this example you use a client certificate for authentication. Ensure that your security settings are correct. For more details, see Configuration of mutual TLS authentication.

Exporting a dataflow with REST API

Using REST API
Trigger the export using the following command, replacing all placeholders with appropriate values:
curl -v --cacert <cert-path>/ca-cert.pem \
--key <cert-path>/admin-key.pem   \
--cert <cert-path>/admin-cert.pem  \
--pass <admin-password> \
--output flow.json \
https://<efm-host>:<efm-port>/efm/api/designer/<test-agent-class>/flows/export
If the export is successful, you can find the exported flow saved in the flow.json file.
Through Swagger
  1. Navigate to the Swagger UI: http://<cem-host>:<cem-port>/efm/swagger/.

    If you have a secure setup, use https in the drop-down at the top of the page.

  2. Go to the Flow Designer section and open /designer/{agentClassName}/flows/export.



  3. Click Try it out.

  4. In the agentClassName field, enter the agent class name that contains the flow you want to export.

  5. Click Execute.

    After a few seconds, Edge Flow Manager returns the flow content in JSON format.

  6. Save the JSON content in a text file.

Importing a dataflow with REST API

Using REST API
Trigger the export using the following command, replacing all placeholders with appropriate values:
curl -v --cacert <cert-path>/ca-cert.pem \
--key <cert-path>/admin-key.pem   \
--cert <cert-path>/admin-cert.pem  \
--pass <admin-password> \
-d @flow.json \
-H 'Content-Type: application/json' \ https://localhost:10090/efm/api/designer/<test-agent-class>/flows/import
Through Swagger
  1. Navigate to the Swagger UI: http://<cem-host>:<cem-port>/efm/swagger/.

    If you have a secure setup, use https in the drop-down at the top of the page.

  2. Go to the Flow Designer section and open /designer/{agentClassName}/flows/import.



  3. Click Try it out.

  4. In the agentClassName field, enter the agent class name where you want to import the flow.

  5. Copy the exported flow content and paste it in the body field.

  6. Click Execute.

    After few seconds, Edge Flow Manager returns the response, indicating whether the import was successful.