PaulJohnson
5 years agoQrew Cadet
Pipeline JSON Schema Samples
Good Evening Everyone
I am trying to import data into QB from an external location (https://www.travel-advisory.info/api) there is nothing confidential at all about this, it is the UK.gov travel advice api and it is free for anyone to use and all it contains is the current advice for travel either to or through 238 countries. There is no authentication of any kind required.
If I point the Fetch JSON pipeline to this site it returns a JSON Data source called Headers, if I look at the data by going to the pipeline step I can see all of the data. After reading I guessed that I needed to use an additional step called Iterate over JSON Steps, I put this in and I am not stumped over what to add into JSON Schema Sample. i have spent all day trying to both write my own or use the data to have sites like https://app.quicktype.io/ create one, in every case QB pipelines says they fail validation and I am not getting a soft squasy noise when I bang my head against the wall.
if anyone has a JSON sample schema that works please can you post it here so that I can see the kind of thing I am striving for. I have added the last one I worked on for reference.
Kindest regards
Paul
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Welcome",
"definitions": {
"Welcome": {
"type": "object",
"additionalProperties": false,
"properties": {
"api_status": {
"$ref": "#/definitions/APIStatus"
},
"data": {
"$ref": "#/definitions/Data"
}
},
"required": [],
"title": "Welcome"
},
"APIStatus": {
"type": "object",
"additionalProperties": false,
"properties": {
"request": {
"$ref": "#/definitions/Request"
},
"reply": {
"$ref": "#/definitions/Reply"
}
},
"required": [],
"title": "APIStatus"
},
"Reply": {
"type": "object",
"additionalProperties": false,
"properties": {
"cache": {
"type": "string"
},
"code": {
"type": "integer"
},
"status": {
"type": "string"
},
"note": {
"type": "string"
},
"count": {
"type": "integer"
}
},
"required": [],
"title": "Reply"
},
"Request": {
"type": "object",
"additionalProperties": false,
"properties": {
"item": {
"type": "string"
}
},
"required": [],
"title": "Request"
},
"Data": {
"type": "object",
"additionalProperties": false,
"properties": {
"DE": {
"$ref": "#/definitions/De"
}
},
"required": [],
"title": "Data"
},
"De": {
"type": "object",
"additionalProperties": false,
"properties": {
"iso_alpha2": {
"type": "string"
},
"name": {
"type": "string"
},
"continent": {
"type": "string"
},
"advisory": {
"$ref": "#/definitions/Advisory"
}
},
"required": [],
"title": "De"
},
"Advisory": {
"type": "object",
"additionalProperties": false,
"properties": {
"score": {
"type": "number"
},
"sources_active": {
"type": "integer"
},
"message": {
"type": "string"
},
"updated": {
"type": "string",
"format": "date-time"
},
"source": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
}
},
"required": [],
"title": "Advisory"
}
}
}
------------------------------
Paul J
------------------------------
I am trying to import data into QB from an external location (https://www.travel-advisory.info/api) there is nothing confidential at all about this, it is the UK.gov travel advice api and it is free for anyone to use and all it contains is the current advice for travel either to or through 238 countries. There is no authentication of any kind required.
If I point the Fetch JSON pipeline to this site it returns a JSON Data source called Headers, if I look at the data by going to the pipeline step I can see all of the data. After reading I guessed that I needed to use an additional step called Iterate over JSON Steps, I put this in and I am not stumped over what to add into JSON Schema Sample. i have spent all day trying to both write my own or use the data to have sites like https://app.quicktype.io/ create one, in every case QB pipelines says they fail validation and I am not getting a soft squasy noise when I bang my head against the wall.
if anyone has a JSON sample schema that works please can you post it here so that I can see the kind of thing I am striving for. I have added the last one I worked on for reference.
Kindest regards
Paul
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Welcome",
"definitions": {
"Welcome": {
"type": "object",
"additionalProperties": false,
"properties": {
"api_status": {
"$ref": "#/definitions/APIStatus"
},
"data": {
"$ref": "#/definitions/Data"
}
},
"required": [],
"title": "Welcome"
},
"APIStatus": {
"type": "object",
"additionalProperties": false,
"properties": {
"request": {
"$ref": "#/definitions/Request"
},
"reply": {
"$ref": "#/definitions/Reply"
}
},
"required": [],
"title": "APIStatus"
},
"Reply": {
"type": "object",
"additionalProperties": false,
"properties": {
"cache": {
"type": "string"
},
"code": {
"type": "integer"
},
"status": {
"type": "string"
},
"note": {
"type": "string"
},
"count": {
"type": "integer"
}
},
"required": [],
"title": "Reply"
},
"Request": {
"type": "object",
"additionalProperties": false,
"properties": {
"item": {
"type": "string"
}
},
"required": [],
"title": "Request"
},
"Data": {
"type": "object",
"additionalProperties": false,
"properties": {
"DE": {
"$ref": "#/definitions/De"
}
},
"required": [],
"title": "Data"
},
"De": {
"type": "object",
"additionalProperties": false,
"properties": {
"iso_alpha2": {
"type": "string"
},
"name": {
"type": "string"
},
"continent": {
"type": "string"
},
"advisory": {
"$ref": "#/definitions/Advisory"
}
},
"required": [],
"title": "De"
},
"Advisory": {
"type": "object",
"additionalProperties": false,
"properties": {
"score": {
"type": "number"
},
"sources_active": {
"type": "integer"
},
"message": {
"type": "string"
},
"updated": {
"type": "string",
"format": "date-time"
},
"source": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
}
},
"required": [],
"title": "Advisory"
}
}
}
------------------------------
Paul J
------------------------------