{
"entity": "ClientCorporation",
"entityMetaUrl": "https://xxx.com?fields=*",
"label": "Company",
"dateLastModified": "1623389646848",
"fields": [
{
"name": "id",
"type": "ID",
"dataType": "Integer"
},
{
"name": "address",
"type": "COMPOSITE",
"dataType": "Address",
"confidential": false,
"label": "Address",
"hideFromSearch": false,
"fields": [
{
"name": "address1",
"type": "SCALAR",
"dataType": "String",
"maxLength": 100,
"confidential": false,
"label": "Main Address",
"hideFromSearch": false
},
{
"name": "address2",
"type": "SCALAR",
"dataType": "String",
"maxLength": 100,
"confidential": false,
"label": "Address2",
"hideFromSearch": false
},
{
"name": "city",
"type": "SCALAR",
"dataType": "String",
"maxLength": 40,
"confidential": false,
"label": "City",
"hideFromSearch": false
},
{
"name": "countryCode",
"type": "SCALAR",
"dataType": "String",
"maxLength": 0
},
{
"name": "countryID",
"type": "SCALAR",
"dataType": "Integer",
"confidential": false,
"label": "Country",
"optionsType": "Country",
"optionsUrl": "https://rest21.bullhornstaffing.com/rest-services/7i8ptd/options/Country",
"hideFromSearch": false
},
{
"name": "countryName",
"type": "SCALAR",
"dataType": "String",
"maxLength": 0
},
I am trying to dynamically list out fields from JSON returned from my API call. The name I need are in the “name” section of the JSON and as you can see there are situations like “address” that also has sub fields. I want to be able to list them all out.
I am trying to make this section of the code work:
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// modify your api response to return an array of Field objects
// see https://zapier.github.io/zapier-platform-schema/build/schema.html#fieldschema
// for schema definition.
return results;
});