Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
geral2 authored Oct 8, 2018
1 parent b0f5203 commit 08deeed
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,23 @@ It uses HttpWebRequest instead of HttpClient in order to avoid having to use uns

### **Sample of calling Authentication Get/POST Method**

EXEC [dbo].APICaller_POST
@URL = ' http://localhost:5000/api/auth/login'
, @Body = '{"username": "geraldo","password": "password"}'


EXEC [dbo].APICaller_GETAuth
@URL = 'http://localhost:5000/api/values'
, @Token = 'Bearer aeyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJnZXJhbGRvIiwibmJmIjoxNTM4MTA3NDkxLCJleHAiOjE1MzgxOTM4OTEsImlhdCI6MTUzODEwNzQ5MX0.j9kX5KXJP6yHBJZZK07tNQayyUkuQf8CtoDDDwdPISZy0eb9RQvnooB3oMND54-5Yzv5LMO9nuM69t2PJh5iXw'
DECLARE @Result AS TABLE
(
Token VARCHAR(MAX)
)

INSERT INTO @Result

exec [dbo].[APICaller_POST]
@URL = 'http://localhost:5000/api/auth/login'
,@BodyJson = '{"Username":"gdiaz","Password":"password"}'

DECLARE @Token AS VARCHAR(MAX)

SELECT TOP 1 @Token = CONCAT('Bearer ',Json.Token)
FROM @Result
CROSS APPLY ( SELECT value AS Token FROM OPENJSON(Result)) AS [Json]

EXEC [dbo].[APICaller_GETAuth]
@URL = 'http://localhost:5000/api/values'
, @Token = @Token

0 comments on commit 08deeed

Please sign in to comment.