Create a PostgreSQL base connection using the Flow Service API
A base connection represents the authenticated connection between a source and Adobe Experience Platform.
This tutorial walks you through the steps to create a base connection for PostgreSQL using the Flow Service API.
Getting started
This guide requires a working understanding of the following components of Adobe Experience Platform:
- Sources: Experience Platform allows data to be ingested from various sources while providing you with the ability to structure, label, and enhance incoming data using Platform services.
- Sandboxes: Experience Platform provides virtual sandboxes which partition a single Platform instance into separate virtual environments to help develop and evolve digital experience applications.
The following sections provide additional information that you will need to know in order to successfully connect to PostgreSQL using the Flow Service API.
Gather required credentials
In order for Flow Service to connect with PostgreSQL, you must provide the following connection property:
connectionString
Server={SERVER};Database={DATABASE};Port={PORT};UID={USERNAME};Password={PASSWORD}
.connectionSpec.id
74a1c565-4e59-48d7-9d67-7c03b8a13137
.For more information about obtaining a connection string, refer to this PostgreSQL document.
Enable SSL encryption for your connection string
You can enable SSL encryption for your PostgreSQL connection string by appending your connection string with the following properties:
EncryptionMethod
EncryptionMethod=0
(Disabled)EncryptionMethod=1
(Enabled)EncryptionMethod=6
(RequestSSL)
ValidateServerCertificate
EncryptionMethod
is applied.ValidationServerCertificate=0
(Disabled)ValidationServerCertificate=1
(Enabled)
The following is an example of a PostgreSQL connection string appended with SSL encryption: Server={SERVER};Database={DATABASE};Port={PORT};UID={USERNAME};Password={PASSWORD};EncryptionMethod=1;ValidateServerCertificate=1
.
Using Platform APIs
For information on how to successfully make calls to Platform APIs, see the guide on getting started with Platform APIs.
Create a base connection
A base connection retains information between your source and Platform, including your source’s authentication credentials, the current state of the connection, and your unique base connection ID. The base connection ID allows you to explore and navigate files from within your source and identify the specific items that you want to ingest, including information regarding their data types and formats.
To create a base connection ID, make a POST request to the /connections
endpoint while providing your PostgreSQL authentication credentials as part of the request parameters.
API format
POST /connections
Request
The following request creates a base connection for PostgreSQL:
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/connections' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-H 'Content-Type: application/json' \
-d '{
"name": "Test connection for PostgreSQL",
"description": "Test connection for PostgreSQL",
"auth": {
"specName": "Connection String Based Authentication",
"params": {
"connectionString": "Server={SERVER};Database={DATABASE};Port={PORT};UID={USERNAME};Password={PASSWORD}"
}
},
"connectionSpec": {
"id": "74a1c565-4e59-48d7-9d67-7c03b8a13137",
"version": "1.0"
}
}'
auth.params.connectionString
Server={SERVER};Database={DATABASE};Port={PORT};UID={USERNAME};Password={PASSWORD}
.connectionSpec.id
74a1c565-4e59-48d7-9d67-7c03b8a13137
.Response
A successful response returns the unique identifier (id
) of the newly created base connection. This ID is required to explore your PostgreSQL database in the next tutorial.
{
"id": "056dd1b4-da33-42f9-add1-b4da3392f94e",
"etag": "\"1700e582-0000-0200-0000-5e3c85180000\""
}
Next steps
By following this tutorial, you have created a PostgreSQL connection base connection using the Flow Service API. You can use this base connection ID in the following tutorials: