NASA-PDS / doi-ui

The web interface for the PDS DOI Service providing the ability management PDS archive DOIs. See the DOI Service for more details on the available capabilities. https://nasa-pds.github.io/doi-service/
Apache License 2.0
0 stars 4 forks source link

Connect UI (reserve) to API #5

Closed tloubrieu-jpl closed 3 years ago

tloubrieu-jpl commented 3 years ago

Connect the UI to a API deployed on dev.

eddiesarevalo commented 3 years ago

@tloubrieu-jpl I am trying to to send up a doi reservation request as specified in the swagger hub API https://app.swaggerhub.com/apis/PDS_APIs/pds_doi_api/0.1#/dois/post_dois but I keep getting a 400 bad request error.

I tried testing by sending up the exact example that is shown in swaggerhub but it still throws a 400 bad request error. Can you please clarify as to what the parameters should look like?

I am sending this POST request payload:

{
  "labels": [
    {
      "status": "Reserved",
      "title": "Laboratory Shocked Feldspars Bundle",
      "publication_date": "2020-03-11",
      "product_type_specific": "PDS4 Collection",
      "author_last_name": "Johnson",
      "author_first_name": "J. R.",
      "related_resource": "urn:nasa:pds:lab_shocked_feldspars"
    }
  ]
}

To this URL: http://localhost:8085/PDS_APIs/pds_doi_api/0.1/dois?action=reserve&submitter=my.email@node.gov&node=eng I am tunneled in and am sure since I can see the list at http://localhost:8085/PDS_APIs/pds_doi_api/0.1/dois

I am not sure if I am missing something here.

tloubrieu-jpl commented 3 years ago

@eddiesarevalo I updated the server since the error message are clearer with the new version.

I tested the request as follow and it worked: curl --location --request POST 'http://localhost:8085/PDS_APIs/pds_doi_api/0.1/dois?action=reserve&submitter=loubrieu@jpl.nasa.gov&node=eng' \ --header 'Content-Type: application/json' \ --data-raw '{ "labels": [ { "status": "Reserved", "title": "Laboratory Shocked Feldspars Bundle collection", "publication_date": "2020-03-11", "product_type_specific": "PDS4 Collection", "author_last_name": "Johnson", "author_first_name": "J. R.", "related_resource": "urn:nasa:pds:lab_shocked_feldspars" } ] } '

Howver if you re-run it you should have error 400 because of duplication, but you'll have the error message in response.

You should use it to display the error to the user.

Thanks