Skip to content

Commit 86b2af0

Browse files
author
nipunnair
committed
Updated docs and setup script to use the flow service calls
1 parent 96b38a2 commit 86b2af0

File tree

2 files changed

+114
-36
lines changed

2 files changed

+114
-36
lines changed

DEVELOPER_GUIDE.md

Lines changed: 75 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,38 +74,87 @@ is to either use your existing authentication token and API key combination, or
7474

7575
Once you have an IMS access token and API key, it needs to be provided as part of the POST request.
7676

77+
Note that the sandbox-name is optional, if not provided will default to the Production sandbox.
78+
79+
7780
```
78-
CURL -X POST "https://platform.adobe.io/data/core/edge/inlet" \
79-
-H "Cache-Control: no-cache" \
80-
-H "Content-Type: application/json" \
81-
-H "Authorization: Bearer {ACCESS_TOKEN}" \
82-
-H "x-api-key: {API_KEY}" \
83-
-H "x-gw-ims-org-id: {IMS_ORG}" \
84-
-d '{
85-
"name" : "<data_inlet_name>",
86-
"description" : "<data_inlet_description>",
87-
"sourceId" : "<identifier_of_device_or_source_that_helps_you_identify_it>",
88-
"dataType": "xdm"
89-
}'
81+
curl -X POST https://platform.adobe.io/data/foundation/flowservice/connections \
82+
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
83+
-H 'Content-Type: application/json' \
84+
-H 'x-gw-ims-org-id: {IMS_ORG}' \
85+
-H 'x-api-key: {API_KEY}' \
86+
-H 'x-sandbox-name: {SANDBOX_NAME}' \
87+
-d '{
88+
"name": "Sample Streaming Connection",
89+
"providerId": "521eee4d-8cbe-4906-bb48-fb6bd4450033",
90+
"description": "Sample description",
91+
"connectionSpec": {
92+
"id": "bc7b00d6-623a-4dfc-9fdb-f1240aeadaeb",
93+
"version": "1.0"
94+
},
95+
"auth": {
96+
"specName": "Streaming Connection",
97+
"params": {
98+
"sourceId": "Sample connection source",
99+
"dataType": "xdm",
100+
"name": "Sample connection"
101+
}
102+
}
103+
}
104+
```
105+
106+
If the request was successful a new Streaming Connection should be created for you. The response will looking similar to
107+
the one below. The `id` field in the response is the Connection Id.
108+
109+
```json
110+
{
111+
"id": "77a05521-91d6-451c-a055-2191d6851c34",
112+
"etag": "\"a500e689-0000-0200-0000-5e31df730000\""
113+
}
90114
```
91115

92-
If the request was successful a new Data Inlet should be created for you. The response will looking similar to
93-
the one below
116+
With the connection created, you can now retrieve your data collection URL from the connection information.
117+
118+
```
119+
curl -X GET https://platform.adobe.io/data/foundation/flowservice/connections/{CONNECTION_ID} \
120+
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
121+
-H 'x-gw-ims-org-id: {IMS_ORG}' \
122+
-H 'x-api-key: {API_KEY}' \
123+
-H 'x-sandbox-name: {SANDBOX_NAME}'
124+
```
94125

95126
```
96127
{
97-
"inletUrl": "https://dcs.adobedc.net/collection/{DATA_INLET_ID}",
98-
"inletId": "{DATA_INLET_ID}",
99-
"imsOrg": "{IMS_ORG}",
100-
"sourceId": "website",
101-
"dataType": "xdm",
102-
"name": "My Data Inlet",
103-
"description": "Collects streaming data from my website",
104-
"authenticationRequired": false,
105-
"createdBy": "{API_KEY}",
106-
"createdAt": "2019-01-11T21:03:49.090Z",
107-
"modifiedBy": "{API_KEY}",
108-
"modifiedAt": "2019-01-11T21:03:49.090Z"
128+
"items": [
129+
{
130+
"createdAt": 1583971856947,
131+
"updatedAt": 1583971856947,
132+
"createdBy": "{API_KEY}",
133+
"updatedBy": "{API_KEY}",
134+
"createdClient": "{USER_ID}",
135+
"updatedClient": "{USER_ID}",
136+
"id": "77a05521-91d6-451c-a055-2191d6851c34",
137+
"name": "Another new sample connection (Experience Event)",
138+
"description": "Sample description",
139+
"connectionSpec": {
140+
"id": "bc7b00d6-623a-4dfc-9fdb-f1240aeadaeb",
141+
"version": "1.0"
142+
},
143+
"state": "enabled",
144+
"auth": {
145+
"specName": "Streaming Connection",
146+
"params": {
147+
"sourceId": "Sample connection (ExperienceEvent)",
148+
"inletUrl": "https://dcs.adobedc.net/collection/a868e1ce678a911ef1482b083329af3cafa4bafdc781285f25911eaae9e00eb2",
149+
"inletId": "a868e1ce678a911ef1482b083329af3cafa4bafdc781285f25911eaae9e00eb2",
150+
"dataType": "xdm",
151+
"name": "Sample connection (ExperienceEvent)"
152+
}
153+
},
154+
"version": "\"56008aee-0000-0200-0000-5e697e150000\"",
155+
"etag": "\"56008aee-0000-0200-0000-5e697e150000\""
156+
}
157+
]
109158
}
110159
```
111160

setup.sh

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,54 @@ INLET_SOURCE=${STREAMING_CONNECTION_SOURCE:-${DEFAULT_INLET_SOURCE}}
166166

167167
echo "Making call to create streaming connection to ${PLATFORM_GATEWAY} with name ${INLET_NAME} and source ${INLET_SOURCE}"
168168

169-
inlet_response=$(curl -i -o - --silent -X POST \
170-
${PLATFORM_GATEWAY}data/core/edge/inlet \
169+
connection_response=$(curl -X POST \
170+
${PLATFORM_GATEWAY}data/foundation/flowservice/connections \
171171
-H "Authorization: Bearer ${access_token}" \
172172
-H "Content-Type: application/json" \
173173
-H "x-api-key: ${CLIENT_ID}" \
174174
-H "x-gw-ims-org-id: ${IMS_ORG}" \
175-
-d '{
176-
"name" : "'"${INLET_NAME}"'",
177-
"description" : "Collects streaming data from my website",
178-
"sourceId" : "'"${INLET_SOURCE}"'",
179-
"dataType": "xdm"
180-
}' 2> /dev/null)
175+
-d '
176+
{
177+
"name": "'"${INLET_NAME}"'",
178+
"providerId": "521eee4d-8cbe-4906-bb48-fb6bd4450033",
179+
"description": "Streaming Connection from kafka topic",
180+
"connectionSpec": {
181+
"id": "bc7b00d6-623a-4dfc-9fdb-f1240aeadaeb",
182+
"version": "1.0"
183+
},
184+
"auth": {
185+
"specName": "Streaming Connection",
186+
"params": {
187+
"sourceId": "'"${INLET_SOURCE}"'",
188+
"dataType": "xdm",
189+
"name": "'"${INLET_NAME}"'"
190+
}
191+
}
192+
}' 2> /dev/null)
193+
194+
connection_response_code=$(echo "${connection_response}" | grep -v '100 Continue' | grep HTTP | awk '{print $2}')
195+
if [[ "${connection_response_code}" -ge "400" ]]; then
196+
echo "Error: Unable to create streaming connection, response code: ${connection_response_code}";
197+
exit 1;
198+
fi
199+
streamingConnectionId=$(echo "${connection_response}" | grep 'id' | jq -r ".id")
200+
201+
echo "Streaming Connection: ${streamingConnectionId}"
202+
203+
inlet_response=$(curl -i -o - --silent \
204+
${PLATFORM_GATEWAY}data/foundation/flowservice/connections/${streamingConnectionId} \
205+
-H "Authorization: Bearer ${access_token}" \
206+
-H "Content-Type: application/json" \
207+
-H "x-api-key: ${CLIENT_ID}" \
208+
-H "x-gw-ims-org-id: ${IMS_ORG}"
209+
2> /dev/null)
181210

182211
inlet_response_code=$(echo "$inlet_response" | grep -v '100 Continue' | grep HTTP | awk '{print $2}')
183212
if [[ "${inlet_response_code}" -ge "400" ]]; then
184-
echo "Error: Unable to create schema, response code: ${inlet_response_code}";
213+
echo "Error: Unable to fetch connection info, response code: ${inlet_response_code}";
185214
exit 1;
186215
fi
187-
streamingEndpoint=$(echo "${inlet_response}" | grep 'inletUrl' | jq -r ".inletUrl")
216+
streamingEndpoint=$(echo "${inlet_response}" | grep "inletUrl" | jq -r ".items[0].auth.params.inletUrl")
188217

189218
echo "Streaming Connection: "${streamingEndpoint}
190219

0 commit comments

Comments
 (0)