Dynamic outputs
One of the properties included with each operation is the boolean hasDynamicOutput
.
A true
value indicates that the output schema can change depending on the input to the Call Connector operation.
In this case when making a call to the call connector endpoint, you just need to set the returnOutputSchema
to true
to get the output schema for that particular request:
{
"operation": "get_location",
"authId": "3a56fxx-xxx-xxx-xxx76fda19",
"input": {
"location_id": "61098065993"
},
"returnOutputSchema":true
}
The following example is from the Get Location operation within the Shopify connector:
When the above payload is used in a call connector request then the output schema is returned and can be used accordingly:
{
"outcome": "success",
"output": {
"output_schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"name": {
"type": "string"
},
"address1": {
"type": "string"
},
"address2": {
"type": "string"
},
"city": {
"type": "string"
},
"zip": {
"type": "string"
},
"province": {
"type": "string"
},
"country": {
"type": "string"
},
"phone": {
"type": "string"
},
"created_at": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"country_code": {
"type": "string"
},
"country_name": {
"type": "string"
},
"province_code": {
"type": "string"
},
"legacy": {
"type": "boolean"
},
"active": {
"type": "boolean"
},
"admin_graphql_api_id": {
"type": "string"
}
}
}
}
}
}
}
If the property is set to false
or not included at all then the call to this endpoint will return the response from the call itself:
{
"outcome": "success",
"output": {
"location": {
"id": 61098065993,
"name": "Test location",
"address1": "Lynchgate Road",
"address2": "22 Cannon Park Centre",
"city": "Coventry",
"zip": "CV4 7EH",
"province": "England",
"country": "GB",
"phone": "+4412345123456",
"created_at": "2021-12-03T18:52:24+00:00",
"updated_at": "2021-12-03T18:52:25+00:00",
"country_code": "GB",
"country_name": "United Kingdom",
"province_code": "ENG",
"legacy": false,
"active": true,
"admin_graphql_api_id": "gid://shopify/Location/61098065993"
}
}
}