metadatacenter / cedar-project

Build project for all CEDAR Java repositories
https://github.com/metadatacenter/cedar-docs/wiki
Other
12 stars 1 forks source link

API for is_based_on search won't work #1046

Open graybeal opened 4 years ago

graybeal commented 4 years ago

If I specify a search for all instances based on a given template in the search API, I can't get it to work.

The given template is https://repo.metadatacenter.org/templates/4595e3d3-b0c5-467b-a967-fec870801624.

(It's the BioSample Demo template, and it should be accessible to everyone.)

The search copy-pasted from Swagger is

https://resource.metadatacenter.org/search?resource_types=instance&version=all&publication_status=all&is_based_on=https%3A%2F%2Frepo.metadatacenter.org%2Ftemplates%2F4595e3d3-b0c5-467b-a967-fec870801624&sort=name&limit=100
R

and the first part of the result copy-pasted from Swagger is

{
  "status": "BAD_REQUEST",
  "errorType": null,
  "errorKey": null,
  "errorReasonKey": null,
  "message": "You must pass not specify 'resource_types' if the 'is_based_on' is specified!",
  "parameters": {
    "is_based_on": "https://repo.metadatacenter.org/templates/4595e3d3-b0c5-467b-a967-fec870801624",
    "resource_types": "instance"
  },
  "entities": {},
  "suggestedAction": "none",
  "originalException": {
    "cause": null,
    "stackTrace": [
      {
        "classLoaderName": "app",
        "moduleName": null,
        "moduleVersion": null,
        "methodName": "<init>",
        "fileName": "CedarException.java",
        "lineNumber": 25,
        "className": "org.metadatacenter.exception.CedarException",
        "nativeMethod": false
      },

This seems to be saying "don't include the resource type", but I tried deleting the resource type parameter (using swagger again) and it still doesn't work, same issue.

This may be operator error, but can't tell why, and it used to work for me. I've confirmed I can do a text-based search for templates successfully.

egyedia commented 4 years ago

The error message was definitely wrong, I just fixed that. Omitting the "resource_types" parameter should fix the issue, however. Please try the following URL: https://resource.metadatacenter.org/search?version=all&publication_status=all&is_based_on=https%3A%2F%2Frepo.metadatacenter.org%2Ftemplates%2F4595e3d3-b0c5-467b-a967-fec870801624&sort=name&limit=100

graybeal commented 4 years ago

When I click on the link you sent, I get an authorization failure.

When I go to the API in production and use the template ID you provided: if I include the resource_types parameter as 'instance' it says "don't include that" (message below), and if I drop it I think Swagger won't process the request, it highlights the field in red.

{ "status": "BAD_REQUEST", "errorType": null, "errorKey": null, "errorReasonKey": null, "message": "You must pass not specify 'resource_types' if the 'is_based_on' is specified!", "parameters": { "is_based_on": "https://repo.metadatacenter.org/templates/4595e3d3-b0c5-467b-a967-fec870801624", "resource_types": "instance" },

john

On Jan 13, 2020, at 3:22 PM, Attila Levente EGYEDI notifications@github.com<mailto:notifications@github.com> wrote:

The error message was definitely wrong, I just fixed that. Omitting the "resource_types" parameter should fix the issue, however. Please try the following URL: https://resource.metadatacenter.org/search?version=all&publication_status=all&is_based_on=https%3A%2F%2Frepo.metadatacenter.org%2Ftemplates%2F4595e3d3-b0c5-467b-a967-fec870801624&sort=name&limit=100

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/metadatacenter/cedar-project/issues/1046?email_source=notifications&email_token=AAJVJUEXBP3CKRJC3F62CNTQ5TZVHA5CNFSM4KCYK7R2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI2VTAI#issuecomment-573921665, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAJVJUCYJVC2KEHSUM5KNSLQ5TZVHANCNFSM4KCYK7RQ.

======================== John Graybeal Technical Program Manager Center for Expanded Data Annotation and Retrieval /+/ NCBO BioPortal Stanford Center for Biomedical Informatics Research 650-736-1632 | ORCID 0000-0001-6875-5360