FAIRDataTeam/FAIRDataPoint

Q:Is there a way to get better error messages from the API?

louis-vinchon opened this issue · 4 comments

The Question
Here's a sample error message from the API:

{
    "data": {
      "timestamp": 1646750105763,
      "status": 406,
      "error": "Not Acceptable",
      "path": "/test"
    }
}

The request was obvisouly rejected. My question is: what is not accpetable in my request?

I can only assume that it's a SHACL validation issue, but the API provides 0 details.

Hello @K41eb,

406 Not Acceptable is a response status defined in HTTP Protocol. It indicates that the server cannot produce a response that would match Accept headers in the HTTP request.

Could you provide the HTTP request you're trying to make?

I was trying to perform the request described in your documentqtion https://fairdatapoint.readthedocs.io/en/latest/usage/api-usage.html

curl -H "Authorization: Bearer efIobn394nvJJFJ30..." \
    -H "Content-Type: text/turtle" \
    -d @metadata.ttl https://fdp.example.com/dataset

but i had an extra header. This particular issue is fixed now, however I now get the following error:

    data: {
      timestamp: 1646830055192,
      status: 400,
      error: 'Bad Request',
      message: 'Validation failed (no rdf:type was provided)'
    }

What exactly is in the metadata.ttl file you're sending to FDP? I've just tried that with the one provided in the documentation page where I only change URI in dct:isPartOf to be an existing catalog and it worked.

I was trying things with my own SHACL shapes and turtle files but that was probably not the best approach, sorry for wasting your time.

I am now trying to create a catalog before the dataset, sometimes I get the SHACL validation errors (I can work with these, all is good on that front), and sometimes I get messages such as Not parent uri for the following ttl:

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<> a dcat:Catalog ;
  dct:title "test" ;
  dct:hasVersion "1.0" ;
  dct:publisher [ a foaf:Agent ; foaf:name "Example User" ] .

I'm having trouble idnetifying what the issue is. And the DCAT documentation isn't helping either.
https://www.w3.org/TR/vocab-dcat-2/

Would you mind sharing your valid catalog and dataset files and api calls?