[Ultimate]{class="badge positive"}
Create a Google PubSub Source Connection Using the Flow Service API
This tutorial walks you through the steps to connect Google PubSub (hereinafter referred to as “PubSub”) to Experience Platform, using the Flow Service API.
Get 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 PubSub to Platform using the Flow Service API.
Gather required credentials
You must provide values for the connection properties outlined below in order to connect your PubSub account to Flow Service. For more information on authentication and prerequisite setup, read the PubSub source overview.
table 0-row-2 1-row-2 2-row-2 3-row-2 | |
---|---|
Credential | Description |
projectId |
The project ID required to authenticate PubSub. |
credentials |
The credential required to authenticate PubSub. You must ensure that you put the complete JSON file after removing the white spaces from your credentials. |
connectionSpec.id |
The connection specification returns a source’s connector properties, including authentication specifications related to creating the base and source target connections. The PubSub connection specification ID is: 70116022-a743-464a-bbfe-e226a7f8210c . |
table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 | |
---|---|
Credential | Description |
credentials |
The credential required to authenticate PubSub. You must ensure that you put the complete JSON file after removing the white spaces from your credentials. |
topicName |
The name of the resource that represents a feed of messages. You must specify a topic name if you want to provide access to a specific stream of data in your PubSub source. The topic name format is: projects/{PROJECT_ID}/topics/{TOPIC_ID} . |
subscriptionName |
The name of your PubSub subscription. In PubSub, subscriptions allow you to receive messages, by subscribing to the topic in which messages have been published to. Note: A single PubSub subscription can only be used for one dataflow. In order to make multiple dataflows, you must have multiple subscriptions. The subscription name format is: projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_ID} . |
connectionSpec.id |
The connection specification returns a source’s connector properties, including authentication specifications related to creating the base and source target connections. The PubSub connection specification ID is: 70116022-a743-464a-bbfe-e226a7f8210c . |
For more information about these values, read this PubSub authentication document. To use service account-based authentication, read this PubSub guide on creating service accounts for steps on how to generate your credentials.
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
The first step in creating a source connection is to authenticate your PubSub source and generate a base connection ID. A base connection ID allows you to explore and navigate files from within your source and identify 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 PubSub authentication credentials as part of the request parameters.
The PubSub source allows you to specify the type of access that you want to allow during authentication. You can set up your account to have root access or restrict access to a particular PubSub topic and subscription.
API format
POST /connections
To create base connection with project-based authentication, make a POST request to the /connections
endpoint and provide your projectId
and credentials
in the request body.
accordion | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Request | ||||||||||||
|
accordion | ||
---|---|---|
Response | ||
A successful response returns details of the newly created connection, including its unique identifier (
|
To create base connection with topic and subscription-based authentication, make a POST request to the /connections
endpoint and provide your credentials
, topicName
, and subscriptionName
in the request body.
accordion | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request | ||||||||||||||
|
accordion | ||
---|---|---|
Response | ||
A successful response returns details of the newly created connection, including its unique identifier (
|
Create a source connection source
A source connection creates and manages the connection to the external source from where data is ingested. A source connection consists of information like data source, data format, and a source connection ID needed to create a dataflow. A source connection instance is specific to a tenant and organization.
To create a source connection, make a POST request to the /sourceConnections
endpoint of the Flow Service API.
API format
POST /sourceConnections
Request
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/sourceConnections' \
-H 'authorization: Bearer {ACCESS_TOKEN}' \
-H 'content-type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"name": "Google PubSub source connection",
"description": "A source connection for Google PubSub",
"baseConnectionId": "4cb0c374-d3bb-4557-b139-5712880adc55",
"connectionSpec": {
"id": "70116022-a743-464a-bbfe-e226a7f8210c",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {
"topicName": "projects/{PROJECT_ID}/topics/{TOPIC_ID}",
"subscriptionName": "projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_ID}",
"dataType": "raw"
}
}'
name
description
baseConnectionId
connectionSpec.id
70116022-a743-464a-bbfe-e226a7f8210c
data.format
json
.params.topicName
params.subscriptionName
params.dataType
raw
and xdm
.Response
A successful response returns the unique identifier (id
) of the newly created source connection. This ID is required in the next tutorial to create a dataflow.
{
"id": "e96d6135-4b50-446e-922c-6dd66672b6b2",
"etag": "\"66013508-0000-0200-0000-5f6e2ae70000\""
}
Next steps
By following this tutorial, you have created a PubSub source connection using the Flow Service API. You can use this source connection ID in the next tutorial to create a streaming dataflow using the Flow Service API.