SmartAPI / smartAPI

Intelligent APIs for a more connected web: https://smart-api.info
MIT License
21 stars 16 forks source link

Cannot successfully run queries through SmartAPI editor or registration page #187

Open colleenXu opened 1 year ago

colleenXu commented 1 year ago

This is not urgent.

For CTD API (just registered https://smart-api.info/registry?q=0212611d1c670f9107baf00b77f0889a), when I "try an example" query, I get TypeError: NetworkError when attempting to fetch resource. This also happens if I copy the SmartAPI yaml into the Editor.

However, the uptime-checking with those same example values seems to be successful. I can run the same query successfully in Postman, the browser, and through BTE (testing on a local instance). With the browser, I get prompted to download the response as a file.

I'm wondering if this is related to the setup of the SmartAPI Editor/UI (references: https://github.com/swagger-api/swagger-editor/issues/1861 and https://github.com/swagger-api/swagger-ui/issues/5750).

Other notes I took * I think the CTD API is returning responses as files and Postman is unpacking / displaying those files. I therefore tried to represent this [in the endpoint spec](https://github.com/NCATS-Tangerine/translator-api-registry/commit/d60f0e1aa939bb3c538cf0ae08328b7ce7d69df3) using this [OpenAPI reference](https://swagger.io/docs/specification/describing-responses/#response-that-returns-a-file) and [these](https://swagger.io/docs/specification/media-types/) [links](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) on [media-types](https://stackoverflow.com/a/49551778). * I don't know whether this behavior can be changed by providing different headers in the request * I notice response-headers that I'm not used to (see screenshot below). I'm not sure how to add them to the endpoint spec, and whether that will help. ![Screen Shot 2023-03-13 at 10 22 59 PM](https://user-images.githubusercontent.com/43731687/224908588-fe89d496-d64f-4cb7-b00c-79c43b36c068.png)
colleenXu commented 1 year ago

Came across while reviewing a potential uptime-checking issue https://github.com/biothings/BioThings_Explorer_TRAPI/issues/558#issuecomment-1459097534

marcodarko commented 1 month ago

This is a CORS related issue :(