SmartAPI / smartapi_registry

This is a repo for people to host their SmartAPI metadata
Apache License 2.0
1 stars 6 forks source link

Automatically test APIs in registry and report on ones that are no longer functioning #4

Open cmungall opened 6 years ago

cmungall commented 6 years ago

It looks like some entries are no longer functional, e.g. http://smart-api.info/ui/?url=/api/metadata/da745f0b6c95ce27e9769a4a0d8d0a15#/

It would be useful to poll the APIs periodically to determine which ones are up, and which ones do not provide 200 responses to example queries

micheldumontier commented 6 years ago

Actually, this does work. it's just that there is a 301 redirect, and seems like the web ui does not follow it

curl -v -L -X GET "http://www.disease-ontology.org/api/metadata/DOID:678"
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 134.192.156.200...
* TCP_NODELAY set
* Connected to www.disease-ontology.org (134.192.156.200) port 80 (#0)
> GET /api/metadata/DOID:678 HTTP/1.1
> Host: www.disease-ontology.org
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 301 MOVED PERMANENTLY
< Date: Wed, 20 Dec 2017 16:00:10 GMT
< Server: Apache/2.4
< Location: http://www.disease-ontology.org/api/metadata/DOID%3A678/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Curl_http_done: called premature == 0
* Connection #0 to host www.disease-ontology.org left intact
* Issue another request to this URL: 'http://www.disease-ontology.org/api/metadata/DOID%3A678/'
* Found bundle for host www.disease-ontology.org: 0x2307d9074e0 [can pipeline]
* Re-using existing connection! (#0) with host www.disease-ontology.org
* Connected to www.disease-ontology.org (134.192.156.200) port 80 (#0)
> GET /api/metadata/DOID%3A678/ HTTP/1.1
> Host: www.disease-ontology.org
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 20 Dec 2017 16:00:11 GMT
< Server: Apache/2.4
< Transfer-Encoding: chunked
< Content-Type: application/json
<
{"definition": "\"A movement disease characterized by serious and progressive problems with control of gait and balance, along with complex eye movement and thinking problems. It involves gradual deterioration and death of specific volumes of the brain.\" [url:http\\://en.wikipedia.org/wiki/Progressive_supranuclear_palsy, url:http\\://www.ninds.nih.gov/disorders/psp/psp.htm]", "xrefs": ["ICD10CM:G23.1", "MESH:D013494", "NCI:C85028", "OMIM:601104", "OMIM:609454", "OMIM:610898", "ORDO:683", "SNOMEDCT_US_2016_03_01:192975003", "SNOMEDCT_US_2016_03_01:192976002", "SNOMEDCT_US_2016_03_01:28978003", "UMLS_CUI:C0038868"], "name": "progressive supranuclear palsy", "subsets": ["DO_rare_slim"], "synonyms": ["progressive supranuclear ophthalmoplegia EXACT MTHICD9_2006:333.0", "Steele-Richardson-Olszewski syndrome EXACT "], "parents": [["is_a", "movement disease", "DOID:480"]], "id": "DOID:678"}* Curl_http_done: called premature == 0
* Connection #0 to host www.disease-ontology.org left intact
micheldumontier commented 6 years ago

@newgene is there anyway to get the webui to follow 301 redirects?

cmungall commented 6 years ago

A good catch

Shouldn't the 301 response be explicitly documented in the swagger?

Not a big deal.

Besides this example that is not a good one for these purposes, there may be other cases where APIs get stale, might be useful to have some kind of periodic check - is this something that could be done with a simple python script over the SmartAPI API? I could take a crack at it

micheldumontier commented 6 years ago

sure - i think it would be useful to get uptime. take a look at this site that monitors sparql endpoints: http://yummydata.org/ what do you think?

newgene commented 6 years ago

@cmungall @micheldumontier in this case, I would rather the API metadata updated with the correct API endpoint path (with the slash). Not the issue for UI web app.

newgene commented 6 years ago

btw @cmungall @micheldumontier, we should create issues in SmartAPI repo instead.

This repo meant to be a default place for people to put their API metadata if they need a place to host.