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 a call can be made to the call connector endpoint described above, you just need to set the "returnOutputSchema" to true to get the output schema for that particular request:

📋
1
{
2
"operation": "get_location",
3
"authId": "3a56fxx-xxx-xxx-xxx76fda19",
4
"input": {
5
"location_id": "61098065993"
6
},
7
"returnOutputSchema":true
8
}

The following example is from the Get Location operation within the Shopify connector:

When the above payload is used in a call connector request to the following endpoint https://api.tray.io/v1/public-connectors/shopify/versions/4.0/call then the output schema is returned and can be used accordingly:

📋
1
{
2
"outcome": "success",
3
"output": {
4
"output_schema": {
5
"$schema": "http://json-schema.org/draft-04/schema#",
6
"type": "object",
7
"properties": {
8
"location": {
9
"type": "object",
10
"properties": {
11
"id": {
12
"type": "number"
13
},
14
"name": {
15
"type": "string"
16
},
17
"address1": {
18
"type": "string"
19
},
20
"address2": {
21
"type": "string"
22
},
23
"city": {
24
"type": "string"
25
},
26
"zip": {
27
"type": "string"
28
},
29
"province": {
30
"type": "string"
31
},
32
"country": {
33
"type": "string"
34
},
35
"phone": {
36
"type": "string"
37
},
38
"created_at": {
39
"type": "string"
40
},
41
"updated_at": {
42
"type": "string"
43
},
44
"country_code": {
45
"type": "string"
46
},
47
"country_name": {
48
"type": "string"
49
},
50
"province_code": {
51
"type": "string"
52
},
53
"legacy": {
54
"type": "boolean"
55
},
56
"active": {
57
"type": "boolean"
58
},
59
"admin_graphql_api_id": {
60
"type": "string"
61
}
62
}
63
}
64
}
65
}
66
}
67
}

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:

📋
1
{
2
"outcome": "success",
3
"output": {
4
"location": {
5
"id": 61098065993,
6
"name": "Test location",
7
"address1": "Lynchgate Road",
8
"address2": "22 Cannon Park Centre",
9
"city": "Coventry",
10
"zip": "CV4 7EH",
11
"province": "England",
12
"country": "GB",
13
"phone": "+4412345123456",
14
"created_at": "2021-12-03T18:52:24+00:00",
15
"updated_at": "2021-12-03T18:52:25+00:00",
16
"country_code": "GB",
17
"country_name": "United Kingdom",
18
"province_code": "ENG",
19
"legacy": false,
20
"active": true,
21
"admin_graphql_api_id": "gid://shopify/Location/61098065993"
22
}
23
}
24
}