---
title: Exporting a connection
description: You can export a connection either manually, using the administrative console, or programmatically through a call to the Connection Management Service.
component: pingfederate
version: 13.1
page_id: pingfederate:developers_reference_guide:pf_export_connect
canonical_url: https://docs.pingidentity.com/pingfederate/13.1/developers_reference_guide/pf_export_connect.html
llms_txt: https://docs.pingidentity.com/pingfederate/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: July 5, 2022
section_ids:
  export-manually: Export manually
  export-via-the-connection-management-service: Export via the Connection Management Service
  code-sample: Code sample
---

# Exporting a connection

You can export a connection either manually, using the administrative console, or programmatically through a call to the Connection Management Service.

Whether you export a connection manually or programmatically, the exported XML complies with the standard SAML 2.0 metadata format, with extensions to capture PingFederate's proprietary configuration. Most connection configuration information is contained in the XML markup, with the exception of global configuration items such as adapter instances, datastores, and key pairs. Adapter instances and datastores are referenced by ID, and key pairs are referenced by the MD5 fingerprint of their X.509 certificate. Public certificates, such as the partner's signature verification certificate, are included completely (base-64 encoded).

## Export manually

For information about using the administrative console to export connections, see [Accessing SP connections](../administrators_reference_guide/help_spconnectionstasklet_connmgmtstate.html) or [Accessing IdP connections](../administrators_reference_guide/help_idpconnectionstasklet_connmgmtstate.html).

## Export via the Connection Management Service

The Connection Management Service exposes the following method for exporting connections.

```
public string getConnection( String entityId, String role,) throws IOException
```

The `entityId` parameter is the connection ID, which identifies the connection to be deleted. The `role` parameter is the connection role, the identity provider (IdP) or the service provider (SP).

## Code sample

The following example invokes this web service to export a connection.

```
Service service = new Service();
Call call = (Call)service.createCall();
call.setUsername("username");
call.setPassword("password");
call.setTargetEndpointAddress("https://localhost:9999/pf-mgmt-ws/ws/ConnectionMigrationMgr");
call.setOperationName("getConnection");
Object result = call.invoke(new Object[] {"<entityId>", "SP"});
```
