biothings / biothings_explorer_archived

BioThings Explorer: a schema-based client for API interoperability
Apache License 2.0
14 stars 14 forks source link

BTE Potentially erroneously considering queries invalid #164

Closed MarkDWilliams closed 3 years ago

MarkDWilliams commented 3 years ago

I had one of my queries get kicked back as lacking the "message" field. The query was working earlier today, and I also tried pulling the example query from the smart-api registration here https://smart-api.info/ui/dc91716f44207d2e1287c727f281d339#/1.0.0/query and running it against https://api.bte.ncats.io/v1/query It fails with the same message. { "message": { "query_graph": { "edges": { "e00": { "object": "n01", "subject": "n00" } }, "nodes": { "n00": { "category": "biolink:Disease", "id": "MONDO:0005737" }, "n01": { "category": "biolink:ChemicalSubstance" } } } } }

{"error":"Your input query graph is invalid","more_info":["body should have required property 'message'"]}

kevinxin90 commented 3 years ago

That's weird. It seems fine on my end:

curl --location --request POST 'https://api.bte.ncats.io/v1/query' \
--header 'Content-Type: application/json' \
--data-raw '{ "message": { "query_graph": { "edges": { "e00": { "object": "n01", "subject": "n00" } }, "nodes": { "n00": { "category": "biolink:Disease", "id": "MONDO:0005737" }, "n01": { "category": "biolink:ChemicalSubstance" } } } } }'

The above query runs fine and is able to return results. Could you confirm on your end?

MarkDWilliams commented 3 years ago

Strange, just tried again and when I add the "Content-Type: application/json" in curl it returns but without it I have the same problem. I thought the ARS handled the content type on its own, but I guess it must not. Looks like that was the root of my issue. Apologies for the inconvenience; closing ticket.