Api endpoint is working with cookies authentication but not with oauth

I am trying to use below api, in postman with oauth 2.0 authentication,

https://{{ngrok}}/api/resource/DocType/Survey%20Form

I got following error.

{
    "exception": "KeyError: 'run_method'",
    "exc_type": "KeyError",
    "exc": "[\"Traceback (most recent call last):\\n  File \\\"apps/frappe/frappe/app.py\\\", line 114, in application\\n    response = frappe.api.handle(request)\\n  File \\\"apps/frappe/frappe/api/__init__.py\\\", line 49, in handle\\n    data = endpoint(**arguments)\\n  File \\\"apps/frappe/frappe/api/v1.py\\\", line 82, in execute_doc_method\\n    method = method or frappe.form_dict.pop(\\\"run_method\\\")\\nKeyError: 'run_method'\\n\"]"
}

But when I access frappe.whitelist I can get it.
above API is working with cookies login. but I want via oauth

@keerthana_2001 share the api call, a screenshot or something

https://speeding-crescent-990158.postman.co/workspace/Oauth~e6a1ea0b-f048-49ba-b989-fa2dc9f1d8f7/collection/24147731-8b8adbf2-5401-4622-9857-d4a1cdad8ac5?action=share&creator=24147731

Here is my postman link,

For your reference

Can you share a curl request here.

Thank you for your response guys,

I found the issue, I was using a wrong HTTP method for this API,

This is curl that I am using now.

curl --location 'https://024152879bf066915262865ea92f6617.serveo.net/api/resource/DocType/Survey%20Form' \
--header 'Authorization: Bearer WqO038nANdTjndqzyVl5HwdFb6fjUC' \
--data ''

Try without body if it’s a GET request

1 Like