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 source connection
You can create a source connection by making a POST request to the Flow Service API. A source connection consists of a connection ID, a path to the source data file, and a connection spec ID.
To create a source connection, you must also define an enum value for the data format attribute.
Use the following the enum values for file-based connectors:
Data format | Enum value |
---|---|
Delimited | delimited |
JSON | json |
Parquet | parquet |
For all table-based connectors, set the value to tabular
.
API format
POST /sourceConnections
Request
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/sourceConnections' \
-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": "Google AdWords source connection",
"baseConnectionId": "2484f2df-c057-4ab5-84f2-dfc0577ab592",
"description": "Google AdWords source connection",
"data": {
"format": "tabular",
},
"params": {
"tableName": "v201809.AD_PERFORMANCE_REPORT",
"columns": [
{
"name": "CallOnlyPhoneNumber",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "AdGroupId",
"type": "long",
"xdm": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
}
},
{
"name": "AdGroupName",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "Date",
"type": "string",
"meta:xdmType": "date-time",
"xdm": {
"type": "string",
"format": "date-time"
}
}
]
},
"connectionSpec": {
"id": "d771e9c1-4f26-40dc-8617-ce58c4b53702",
"version": "1.0"
}
}'
Property | Description |
---|---|
baseConnectionId | The unique connection ID of the advertising application you are accessing. |
params.path | The path of the source file. |
connectionSpec.id | The connection spec ID associated with your advertising application. |
Response
A successful response returns the unique identifier (id
) of the newly created source connection. Store this value as it is required in later steps for creating a target connection.
{
"id": "ca7b8baa-587e-4223-bb8b-aa587e4223e3",
"etag": "\"5701cdf0-0000-0200-0000-5e9680af0000\""
}
Create a target XDM 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
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
A target connection represents the connection to the destination where the ingested data lands in. To create a target connection, you must provide the fixed connection spec ID associated to the Data Lake. This connection spec 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 data lake. Using the Flow Service API, you can create a target connection by specifying these identifiers along with the dataset that will contain the inbound source data.
API format
POST /targetConnections
Request
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": "Google AdWords target connection,
"description": "Google AdWords target connection,
"data": {
"schema": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/b9bf50e91f28528e5213c7ed8583018f48970d69040c37dc",
"version": "application/vnd.adobe.xed-full+json;version=1"
}
},
"params": {
"dataSetId": "5e9681e389b80418ad4b3df0"
},
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
}
}'
Property | Description |
---|---|
data.schema.id | The $id of the target XDM schema. |
data.schema.version | The version of the schema. This value must be set application/vnd.adobe.xed-full+json;version=1 , which returns the latest minor version of the schema. |
params.dataSetId | The ID of the target dataset generated in the previous step. Note: You must provide a valid dataset ID when creating a target connection. An invalid dataset ID will result in an error. |
connectionSpec.id | The connection spec ID used to connect to the data lake. This ID is: c604ff05-7f1a-43c0-8e18-33bf874cb11c . |
{
"id": "41af25df-cd99-4372-af25-dfcd99b37291",
"etag": "\"4d01178a-0000-0200-0000-5e9683380000\""
}
Create a 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.
To create a mapping set, make a POST request to the mappingSets
endpoint of the Data Prep API while providing your target XDM schema $id
and the details of the mapping sets you want to create.
API format
POST /conversion/mappingSets
Request
curl -X POST \
'https://platform.adobe.io/data/foundation/conversion/mappingSets' \
-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 '{
"version": 0,
"xdmSchema": "https://ns.adobe.com/{TENANT_ID}/schemas/b9bf50e91f28528e5213c7ed8583018f48970d69040c37dc",
"xdmVersion": "1.0",
"id": null,
"mappings": [
{
"destinationXdmPath": "person.name.firstName",
"sourceAttribute": "first_name",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
},
{
"destinationXdmPath": "person.name.lastName",
"sourceAttribute": "last_name",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
},
{
"destinationXdmPath": "personalEmail.address",
"sourceAttribute": "email",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
}
]
}'
Property | Description |
---|---|
xdmSchema | The ID of the target XDM schema. |
Response
A successful response returns details of the newly created mapping including its unique identifier (id
). This value is required in a later step to create a dataflow.
{
"id": "febec6a6785e45ea9ed594422cc483d7",
"version": 0,
"createdDate": 1589398562232,
"modifiedDate": 1589398562232,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}