Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API endpoint method not supported for Signed URL #10704

Closed
nana-boateng opened this issue Jul 19, 2024 · 5 comments
Closed

API endpoint method not supported for Signed URL #10704

nana-boateng opened this issue Jul 19, 2024 · 5 comments
Labels
Type: Bug a defect

Comments

@nana-boateng
Copy link

nana-boateng commented Jul 19, 2024

I am attempting to use a signed URL to make changes to a file. Prior to signed URLS, we used /api/v1/edit/{fileID} with an xml payload in a POST request to make changes, but the same route doesn't seem work for signed URLs. I get this error back:

{ "status": "ERROR", "code": 405, "message": "API endpoint does not support this method. Consult our API guide at http://guides.dataverse.org.", "requestUrl": "https://demo.borealisdata.ca/api/v1/edit/40226?until=2024-07-19T21:22:41.852&user=n.boateng&method=POST&token=9050a37554152c4b8ed46b734698ce51a39a200280f32b9cd92194588bcd03ef826cddf30366fc5a23e59699b0ced2d694941441684da0456373f7a74608d319", "requestMethod": "POST" }

Here is an example of the data object returned in the initial signed request:

    "queryParameters": {
        "fileId": 40226,
        "fileMetadataId": 39564,
        "datasetPid": "doi:10.80240/FK2/KLPDSV"
    },
    "signedUrls": [
        {
            "name": "retrieveDataFile",
            "httpMethod": "GET",
            "signedUrl": "https://demo.borealisdata.ca/api/v1/access/datafile/40226/metadata/ddi?until=2024-07-19T21:22:41.851&user=n.boateng&method=GET&token=random32423423token",
            "timeOut": 270
        },
        {
            "name": "uploadDataFile",
            "httpMethod": "POST",
            "signedUrl": "https://demo.borealisdata.ca/api/v1/edit/40226?until=2024-07-19T21:22:41.852&user=n.boateng&method=POST&token=random32423423token",
            "timeOut": 270
        }
    ]
}

And I am using the second signed URL to upload changes.

Here is my manifest file:

{
  "displayName": "DataExplorer",
  "description": "Odesi Data Explorer for viewing, configuring and editing variables",
  "toolName": "explorer",
  "scope": "file",
  "type": "configure",
  "contentType": "text/tab-separated-values",
  "toolUrl": "https://demo.borealisdata.ca/data-explorer-test/",
  "toolParameters": {
    "queryParameters": [
      {
        "fileId": "{fileId}"
      },
      {
        "fileMetadataId": "{fileMetadataId}"
      },
      {
        "datasetPid": "{datasetPid}"
      },
      {
        "dvLocale": "{localeCode}"
      }
    ]
  },
  "allowedApiCalls": [
    {
      "name": "retrieveDataFile",
      "httpMethod": "GET",
      "urlTemplate": "/api/v1/access/datafile/{fileId}/metadata/ddi",
      "timeOut": 270
    },
    {
      "name": "uploadDataFile",
      "httpMethod": "POST",
      "urlTemplate": "/api/v1/edit/{fileId}",
      "timeOut": 270
    }
  ]
}

What steps does it take to reproduce the issue?
Apologies for the verbosity, but because this is related to signed URLs, I couldn't figure out an easy link to send.

  • When does this issue occur?
    When you attempt to use the signed URL to edit changes in a dataset.

  • Which page(s) does it occurs on?
    API call.

  • What happens?
    I get a message: "API endpoint does not support this method. Consult our API guide at http://guides.dataverse.org."

  • To whom does it occur (all users, curators, superusers)?
    Curators

  • What did you expect to happen?
    The upload to complete or maybe a new API endpoint

Which version of Dataverse are you using?

v6.2.8-SP

Any related open or closed issues to this bug report?

@nana-boateng nana-boateng added the Type: Bug a defect label Jul 19, 2024
@pdurbin
Copy link
Member

pdurbin commented Jul 19, 2024

"requestUrl": "https://demo.borealisdata.ca/api/v1/edit

Wow, /api/edit doesn't feel right (I would expect an additional word like "file" or "metadata" or "fileMetadata" to be in the path) but it's true. It was added in #5971 and the docs do say just "/api/edit": https://guides.dataverse.org/en/6.3/api/native-api.html#editing-variable-level-metadata

Anyway, thanks for the bug report @nana-boateng. I'm not sure why it isn't working. On a related note, this week during a pyDataverse meeting we talked about how we'd like to support signed URLs:

@nana-boateng
Copy link
Author

Looks like the httpMethod is PUT and not POST, as written in this comment gdcc/pyDataverse#200 (comment)

Thanks for the quick reply and help @pdurbin!

@pdurbin
Copy link
Member

pdurbin commented Jul 22, 2024

Ah, great. (And thanks to @qqmyers for catching that PUT vs POST.)

Is there anything to fix for this issue? If not, should we close it?

@nana-boateng
Copy link
Author

Nothing else, feel free to close it. :)

@pdurbin
Copy link
Member

pdurbin commented Jul 23, 2024

Ok, closing. FYI, as the person who opened an issue, you should also have the power to close it. 😄

Thanks for flying Dataverse! ✈️

@pdurbin pdurbin closed this as completed Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug a defect
Projects
None yet
Development

No branches or pull requests

2 participants