Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2364

How to use token in header of REST API request?

$
0
0
by Ben A.  

I have setup web services and am able to successfully callout to Moodle using Postman using the token as a parameter (ie: .../server.php?wstoken=[mytoken]).

However, I want to pass the token as a header in the request. I'm sure I saw this somewhere in the docs but cannot find it. I've tried various authorisation types in postman, and have also tried adding as a header with a Key of "Authorization", "Token", "wstoken", etc.

The response I get back is:
{
"exception": "moodle_exception",
"errorcode": "invalidtoken",
"message": "Invalid token - token not found"
}

Can anyone help with how to pass the token in the header of a rest callout? Thanks


Viewing all articles
Browse latest Browse all 2364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>