1

When calling a rest api with POST I would like to know all information in the response and its header. For example, we need to handle a JWT. How is that possible in MDriven? In the vResponse I get the response body, but I would like to access, for example, the response status code.

Example code:

vResponse := selfVM.RestPost('https://myurl.site.com/app/api/Method','','','MyParams')
  • ...on the sign in request you will receive the token as a responce. I do not understand the quetsion. Look at the Spotify authentication sample - its not JWT's but the its OAUTH (JWT is just how the token constructed) https://blog.mdriven.net/getting-data-from-anywhere-like-for-example-spotify-that-is-oauth2-protected/ – Hans Karlsen Sep 07 '20 at 15:42

1 Answers1

0

When you are sending : The authorization header holds the credentials. We create this based on the values you give to the RestPost user and pwd params.

If the user is Bearer the pwd is assumed to be the token. The token may be a JWT token. If the users is not Bearer or bearer we assume it is a non token login and the the header gets the base64 of user:pwd. This is described here https://wiki.mdriven.net/index.php/OCLOperators_RestPost.

What I wrote above describes the quick/shorthand-way to handle authorization headers - you may of course leave user and pwd params empty and add the header yourself with as described in this article: https://wiki.mdriven.net/index.php/Rest_Services_In_MDriven

Hans Karlsen
  • 2,275
  • 1
  • 15
  • 15