[Beta]{class="badge informative"}
Create a source connection and dataflow for SAP Commerce using the Flow Service API
The following tutorial walks you through the steps to create a SAP Commerce source connection and a dataflow to bring SAP Subscription Billing contacts and customer data to Adobe Experience Platform using the Flow Service API.
Getting started
This guide requires a working understanding of the following components of 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 SAP Commerce using the Flow Service API.
Gather required credentials
In order to connect SAP Commerce to Experience Platform, you must provide values for the following connection properties:
clientId
clientId
from the service key.clientSecret
clientSecret
from the service key.tokenEndpoint
url
from the service key, it will be similar to https://subscriptionbilling.authentication.eu10.hana.ondemand.com
.region
url
and has a value similar to eu10
or us10
. For example if the url
is https://subscriptionbilling.authentication.eu10.hana.ondemand.com
, then you will need eu10
.For more information on these credentials, please refer to the SAP Commerce documentation.
Connect SAP Commerce to Platform using the Flow Service API
The following outlines the steps you need to make in order to authenticate your SAP Commerce source, create a source connection, and create a dataflow to bring your accounts and contacts data to Experience Platform.
Create a base connection 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 SAP Commerce authentication credentials as part of the request body.
API format
POST /connections
Request
The following request creates a base connection for SAP Commerce:
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": "SAP Commerce base connection",
"description": "Authenticated base connection for SAP Commerce",
"connectionSpec": {
"id": "d8ee38de-7ae9-4058-9610-c79ce75f8e92",
"version": "1.0"
},
"auth": {
"specName": "OAuth2 Client Credential",
"params": {
"region": "{REGION}",
"clientId": "{CLIENT_ID}",
"clientSecret": "{CLIENT_SECRET}"
"tokenEndpoint": "{TOKEN_ENDPOINT}"
}
}
}'
name
description
connectionSpec.id
auth.specName
auth.params.region
url
and has a value similar to eu10
or us10
. For example, if the url
is https://subscriptionbilling.authentication.eu10.hana.ondemand.com
you will need eu10
.auth.params.clientId
clientId
from the service key.auth.params.clientSecret
clientSecret
from the service key.auth.params.tokenEndpoint
url
from the service key, it will be similar to https://subscriptionbilling.authentication.eu10.hana.ondemand.com
.Response
A successful response returns the newly created base connection, including its unique connection identifier (id
). This ID is required to explore your source’s file structure and contents in the next step.
{
"id": "5f6d6022-3f64-400c-ba01-d4010de2d8ff",
"etag": "\"f8018de1-0000-0200-0000-6482d7210000\""
}
Explore your source explore
Once you have your base connection ID, you can now exploree the content and structure of your source data by performing a GET request to the /connections
endpoint while providing your base connection ID as a query parameter.
API format
GET /connections/{BASE_CONNECTION_ID}/explore?objectType=rest&object={OBJECT}&fileType={FILE_TYPE}&preview={PREVIEW}&sourceParams={SOURCE_PARAMS}
When performing GET requests to explore your source’s file structure and contents, you must include the query parameters that are listed in the table below:
{BASE_CONNECTION_ID}
objectType=rest
rest
.{OBJECT}
json
.fileType=json
json
is the only supported file type.{PREVIEW}
{SOURCE_PARAMS}
Defines parameters for the source file you want to bring to Platform. To retrieve the accepted format-type for {SOURCE_PARAMS}
, you must encode the entire string in base64.
SAP Commerce supports multiple APIs. Depending on which object type you are leveraging, pass one of the below :
customers
contacts
The SAP Commerce source supports multiple APIs. Depending on which object type you are leveraging the request to be sent is as below:
accordion | ||
---|---|---|
Request | ||
For SAP Commerce Customers API the value for
|
accordion | ||
---|---|---|
Response | ||
A successful response returns a JSON structure like the following:
|
accordion | ||
---|---|---|
Request | ||
For SAP Commerce Contacts API the value for
|
accordion | ||
---|---|---|
Response | ||
A successful response returns a JSON structure like the following:
|
Create a source connection source-connection
You can create a source connection by making a POST request to the /sourceConnections
endpoint of the Flow Service API. A source connection consists of a connection ID, a path to the source data file, and a connection spec ID.
API format
POST /sourceConnections
Depending on which object type you are leveraging, select from the tabs below:
accordion | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request | ||||||||||||||||||||
The following request creates a source connection for SAP Commerce customers data:
|
accordion | ||
---|---|---|
Response | ||
A successful response returns the unique identifier (
|
accordion | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request | ||||||||||||||||||||
The following request creates a source connection for SAP Commerce contacts data:
|
accordion | ||
---|---|---|
Response | ||
A successful response returns the unique identifier (
|
Create a target XDM schema target-schema
In order for the source data to be used in Platform, a target schema must be created to structure the source data according to your needs. The target schema is then used to create a Platform dataset in which the source data is contained.
A target XDM schema can be created by performing a POST request to the Schema Registry API.
For detailed steps on how to create a target XDM schema, see the tutorial on creating a schema using the API.
Create a target dataset target-dataset
A target dataset can be created by performing a POST request to the Catalog Service API, providing the ID of the target schema within the payload.
For detailed steps on how to create a target dataset, see the tutorial on creating a dataset using the API.
Create a target connection target-connection
A target connection represents the connection to the destination where the ingested data is to be stored. To create a target connection, you must provide the fixed connection spec ID that corresponds to the data lake. This ID is: c604ff05-7f1a-43c0-8e18-33bf874cb11c
.
You now have the unique identifiers a target schema a target dataset and the connection spec ID to the data lake. Using these identifiers, you can create a target connection using the Flow Service API to specify the dataset that will contain the inbound source data.
API format
POST /targetConnections
Request
The following request creates a target connection for SAP Commerce:
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/targetConnections' \
-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": "SAP Commerce Target Connection Generic Rest",
"description": "SAP Commerce Target Connection Generic Rest",
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
},
"data": {
"format": "parquet_xdm",
"schema": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/325fd5394ba421246b05c0a3c2cd5efeec2131058a63d473",
"version": "1.2"
}
},
"params": {
"dataSetId": "645923cd7aeeea1c06c5e92e"
}
}'
name
description
connectionSpec.id
6b137bf6-d2a0-48c8-914b-d50f4942eb85
.data.format
params.dataSetId
Response
A successful response returns the new target connection’s unique identifier (id
). This ID is required in later steps.
{
"id": "5b72a4b6-2fb8-4ca7-8ad8-4114a3063c5c",
"etag": "\"db00c6dc-0000-0200-0000-6482d8280000\""
}
Create a mapping mapping
In order for the source data to be ingested into a target dataset, it must first be mapped to the target schema that the target dataset adheres to. This is achieved by performing a POST request to Data Prep API with data mappings defined within the request payload.
API format
POST /conversion/mappingSets
accordion | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request | ||||||||||||||
The following request creates a mapping for SAP Commerce Customers API data
|
accordion | ||
---|---|---|
Response | ||
A successful response returns details of the newly created mapping including its unique identifier (
|
accordion | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request | ||||||||||||||
The following request creates a mapping for SAP Commerce Contacts API data
|
accordion | ||
---|---|---|
Response | ||
A successful response returns details of the newly created mapping including its unique identifier (
|
Create a flow flow
The last step towards bringing data from SAP Commerce to Platform is to create a dataflow. By now, you have the following required values prepared:
A dataflow is responsible for scheduling and collecting data from a source. You can create a dataflow by performing a POST request while providing the previously mentioned values within the payload.
API format
POST /flows
Request
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/flows' \
-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": "SAP Commerce Connector Description Flow Generic Rest",
"description": "SAP Commerce Connector Description Flow Generic Rest",
"flowSpec": {
"id": "6499120c-0b15-42dc-936e-847ea3c24d72",
"version": "1.0"
},
"sourceConnectionIds": [
"2ef2e831-f4f1-4363-a0f7-08b4ea347164"
],
"targetConnectionIds": [
"5b72a4b6-2fb8-4ca7-8ad8-4114a3063c5c"
],
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "ddf0592bcc9d4ac391803f15f2429f87",
"mappingVersion": "0"
}
}
],
"scheduleParams": {
"startTime": "1625040887",
"frequency": "once",
}
}'
name
description
flowSpec.id
6499120c-0b15-42dc-936e-847ea3c24d72
.flowSpec.version
1.0
.sourceConnectionIds
targetConnectionIds
transformations
transformations.name
transformations.params.mappingId
transformations.params.mappingVersion
0
.scheduleParams.startTime
scheduleParams.frequency
scheduleParams.interval
Response
A successful response returns the ID (id
) of the newly created dataflow. You can use this ID to monitor, update, or delete your dataflow.
{
"id": "fcd16140-81b4-422a-8f9a-eaa92796c4f4",
"etag": "\"9200a171-0000-0200-0000-6368c1da0000\""
}
Appendix
The following section provides information on the steps you can to monitor, update, and delete your dataflow.
Monitor your dataflow
Once your dataflow has been created, you can monitor the data that is being ingested through it to see information on flow runs, completion status, and errors. For complete API examples, read the guide on monitoring your sources dataflows using the API.
Update your dataflow
Update the details of your dataflow, such as its name and description, as well as its run schedule and associated mapping sets by making a PATCH request to the /flows
endpoint of Flow Service API, while providing the ID of your dataflow. When making a PATCH request, you must provide your dataflow’s unique etag
in the If-Match
header. For complete API examples, read the guide on updating sources dataflows using the API.
Update your account
Update the name, description, and credentials of your source account by performing a PATCH request to the Flow Service API while providing your base connection ID as a query parameter. When making a PATCH request, you must provide your source account’s unique etag
in the If-Match
header. For complete API examples, read the guide on updating your source account using the API.
Delete your dataflow
Delete your dataflow by performing a DELETE request to the Flow Service API while providing the ID of the dataflow you want to delete as part of the query parameter. For complete API examples, read the guide on deleting your dataflows using the API.
Delete your account
Delete your account by performing a DELETE request to the Flow Service API while providing the base connection ID of the account you want to delete. For complete API examples, read the guide on deleting your source account using the API.