ISAITB / validator-resources-dcat-ap

Validator resources for the DCAT-AP RDF validator.
1 stars 2 forks source link

504 Gateway Time-out when running SHACL Validator REST API in Python #4

Closed jhaezaerts closed 6 months ago

jhaezaerts commented 6 months ago

I am attempting to run a simple python script that validates an RDF instance. However, I keep running into the same error.

Here's the Python code:

base_url = "https://www.itb.ec.europa.eu/shacl" endpoint = "/{domain}/api/validate" domain = 'dcat-ap'

request_body = { "contentToValidate": 'https://metadata.vlaanderen.be/api/collections/main/items/d676d38c-e190-47a0-b963-1a60f30ed58a?f=dcat_ap_vl', "contentSyntax": "application/rdf+xml", "validationType": "v3.Codelists", }

url = base_url + endpoint.replace("{domain}", domain) response = requests.post(url, json=request_body)

if response.status_code == 200: validation_report = response.json() print("Validation report:", validation_report) else: print("Error:", response.status_code, response.text)

Error: image

costas80 commented 6 months ago

@jhaezaerts, there was a service health issue with the validator that is now resolved. If you try again it should be working without problems.

By the way, checking your JSON payload there were a few problems (probably due to copy & pasting on GitHub). Specifically you mixed single and double quotes, and also added a trailing comma for the last property. The correct payload would be (just tried and it works as expected):

{
  "contentToValidate": "https://metadata.vlaanderen.be/api/collections/main/items/d676d38c-e190-47a0-b963-1a60f30ed58a?f=dcat_ap_vl",
  "contentSyntax": "application/rdf+xml",
  "validationType": "v3.Codelists"
}
jhaezaerts commented 6 months ago

Works as expected now, thank you!