Passthrough APIs
Passthrough APIs let you make raw HTTP requests to the underlying application. They are best used for endpoints we don't support in our unified model.
This collection teaches you how to make passthrough requests to the Shopify and Salesforce Commerce Cloud APIs. You will need connectionIds for both Shopify and Salesforce to proceed.
| Variable | Description | Example |
|---|---|---|
API_VERSION | Represents the version of the Alloy Unified API you intend to make calls to. API versions are dated and new versions are released quarterly (in March, June, September, and December). | 2023-12 |
apiKey | Your API key. Never share this with anyone. | |
shopifyConnectionId | The connectionId used to make passthrough requests to Shopify |
To make passthrough requests, hit the POST /forward endpoint. You'll need to specify the body values as seen below:
Figure 1.1 – GET Customers in Shopify
JSON
{
"method": "GET",
"endpoint": "/customers.json",
"body": null,
"query": null,
"extraHeaders": null
}
- The method key accepts
GET,POST,UPDATE/PUTandDELETE. - The
endpointkey tells the passthrough endpoint where to make the request. In this case, we're using thecustomers.jsonendpoint in the Shopify API. Note that the.jsonextension is not required for all endpoints and is just a convention Shopify uses. - The
bodyvalue allows you to pass JSON that might be needed in a POST or PUT/UPDATE request. - Similarly, the
queryvalue allows you to pass query string parameters in JSON format. - Lastly, the
extraHeadersallows you to send along values you'd like appended to the HTTP headers.
Figure 1.1 above shows us how to make a GET request to the Shopify GET /customers.json endpoint. Let's say we wanted to make a POST request to create a new customer. We could do so by supplying a body as seen below:
cURL
curl --location 'https://embedded.runalloy.com/2023-12/one/forward?connectionId={{YOUR_CONNECTION_ID}}' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"method": "POST",
"endpoint": "/customers.json",
"body": {
"customer": {
"id": 1073339469,
"email": "steve.lastnameson@example.com",
"accepts_marketing": false,
"created_at": "2023-12-11T10:28:27-05:00",
"updated_at": "2023-12-11T10:28:27-05:00",
"first_name": "Steve",
"last_name": "Lastnameson",
"orders_count": 0
}
},
"query": null,
"extraHeaders": null
}
'
Download the Collection
Download the full collection below.
{
"info": {
"_postman_id": "072b61c9-d49a-46ac-a8c5-fb03357474d5",
"name": "Passthrough Requests – Alloy Unified API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "10048813",
"_collection_link": ""
},
"item": [
{
"name": "Shopify Get Customers",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[Shopify] customers are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customers');",
" pm.expect(jsonData.customers[0]).to.not.be.null;",
" pm.expect(jsonData.customers[0]).to.have.property('remoteId');",
" pm.expect(jsonData.customers[0]).to.have.property('updatedTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('lastName');",
" pm.expect(jsonData.customers[0]).to.have.property('email');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('phone');",
" pm.expect(jsonData.customers[0]).to.have.property('firstName');",
" pm.expect(jsonData.customers[0]).to.have.property('id');",
"});",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"method\": \"GET\",\n \"endpoint\": \"/customers.json\",\n \"body\": null,\n \"query\": null,\n \"extraHeaders\": null\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://embedded.runalloy.com/{{API_VERSION}}/one/forward?connectionId={{shopifyConnectionId}}",
"host": ["https://embedded.runalloy.com"],
"path": ["{{API_VERSION}}", "one", "forward"],
"query": [
{
"key": "cursor",
"value": "",
"disabled": true
},
{
"key": "pageSize",
"value": "2",
"disabled": true
},
{
"key": "firstNameContains",
"value": "Test",
"disabled": true
},
{
"key": "sampleData",
"value": "true",
"disabled": true
},
{
"key": "connectionId",
"value": "{{shopifyConnectionId}}"
}
]
}
},
"response": []
},
{
"name": "Shopify List Products",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[Shopify] customers are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customers');",
" pm.expect(jsonData.customers[0]).to.not.be.null;",
" pm.expect(jsonData.customers[0]).to.have.property('remoteId');",
" pm.expect(jsonData.customers[0]).to.have.property('updatedTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('lastName');",
" pm.expect(jsonData.customers[0]).to.have.property('email');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('phone');",
" pm.expect(jsonData.customers[0]).to.have.property('firstName');",
" pm.expect(jsonData.customers[0]).to.have.property('id');",
"});",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"method\": \"GET\",\n \"endpoint\": \"/products.json\",\n \"body\": null,\n \"query\": null,\n \"extraHeaders\": null\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://embedded.runalloy.com/{{API_VERSION}}/one/forward?connectionId={{shopifyConnectionId}}",
"host": ["https://embedded.runalloy.com"],
"path": ["{{API_VERSION}}", "one", "forward"],
"query": [
{
"key": "cursor",
"value": "",
"disabled": true
},
{
"key": "pageSize",
"value": "2",
"disabled": true
},
{
"key": "firstNameContains",
"value": "Test",
"disabled": true
},
{
"key": "sampleData",
"value": "true",
"disabled": true
},
{
"key": "connectionId",
"value": "{{shopifyConnectionId}}"
}
]
}
},
"response": []
},
{
"name": "Shopify Count All products",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[Shopify] customers are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customers');",
" pm.expect(jsonData.customers[0]).to.not.be.null;",
" pm.expect(jsonData.customers[0]).to.have.property('remoteId');",
" pm.expect(jsonData.customers[0]).to.have.property('updatedTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('lastName');",
" pm.expect(jsonData.customers[0]).to.have.property('email');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('phone');",
" pm.expect(jsonData.customers[0]).to.have.property('firstName');",
" pm.expect(jsonData.customers[0]).to.have.property('id');",
"});",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"method\": \"GET\",\n \"endpoint\": \"/customers.json\",\n \"body\": null,\n \"query\": null,\n \"extraHeaders\": null\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://embedded.runalloy.com/{{API_VERSION}}/one/forward?connectionId={{shopifyConnectionId}}",
"host": ["https://embedded.runalloy.com"],
"path": ["{{API_VERSION}}", "one", "forward"],
"query": [
{
"key": "cursor",
"value": "",
"disabled": true
},
{
"key": "pageSize",
"value": "2",
"disabled": true
},
{
"key": "firstNameContains",
"value": "Test",
"disabled": true
},
{
"key": "sampleData",
"value": "true",
"disabled": true
},
{
"key": "connectionId",
"value": "{{shopifyConnectionId}}"
}
]
}
},
"response": []
},
{
"name": "SFCC List Products",
"event": [
{
"listen": "test",
"script": {
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"var contentTypeHeaderExists = responseHeaders.hasOwnProperty(\"Content-Type\");",
"tests[\"Has Content-Type\"] = contentTypeHeaderExists;",
" ",
"if (contentTypeHeaderExists) {",
" tests[\"Content-Type is application/json\"] = ",
" responseHeaders[\"Content-Type\"].has(\"application/json\");",
"}",
"",
"pm.test(\"response should be okay to process\", function () {",
" pm.response.to.have.status(200);",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"",
"pm.test(\"[Shopify] customers are listed correctly\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('customers');",
" pm.expect(jsonData.customers[0]).to.not.be.null;",
" pm.expect(jsonData.customers[0]).to.have.property('remoteId');",
" pm.expect(jsonData.customers[0]).to.have.property('updatedTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('lastName');",
" pm.expect(jsonData.customers[0]).to.have.property('email');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('createdTimestamp');",
" pm.expect(jsonData.customers[0]).to.have.property('phone');",
" pm.expect(jsonData.customers[0]).to.have.property('firstName');",
" pm.expect(jsonData.customers[0]).to.have.property('id');",
"});",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{apiKey}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"method\": \"GET\",\n \"endpoint\": \"/product/products/v1/organizations/f_ecom_zyez_001/products/apple-ipod-classic\",\n \"body\": null,\n \"query\": null,\n \"extraHeaders\": null\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://embedded.runalloy.com/{{API_VERSION}}/one/forward?connectionId={{salesforceCCConnectionId}}",
"host": ["https://embedded.runalloy.com"],
"path": ["{{API_VERSION}}", "one", "forward"],
"query": [
{
"key": "cursor",
"value": "",
"disabled": true
},
{
"key": "pageSize",
"value": "2",
"disabled": true
},
{
"key": "firstNameContains",
"value": "Test",
"disabled": true
},
{
"key": "sampleData",
"value": "true",
"disabled": true
},
{
"key": "connectionId",
"value": "{{salesforceCCConnectionId}}"
}
]
}
},
"response": []
}
]
}