From 390bf0b72afdc527228342355ea7915408f3f7ce Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Thu, 20 Jun 2024 13:46:00 -0400 Subject: [PATCH] Fix some endpoints in web.http --- src/Web/Web.http | 114 ++++------------------------------- src/Web/http-client.env.json | 5 ++ 2 files changed, 17 insertions(+), 102 deletions(-) create mode 100644 src/Web/http-client.env.json diff --git a/src/Web/Web.http b/src/Web/Web.http index 105a254..c0ac5aa 100644 --- a/src/Web/Web.http +++ b/src/Web/Web.http @@ -1,12 +1,10 @@ # For more info on HTTP files go to https://aka.ms/vs/httpfile -@Web_HostAddress = https://localhost:5001 - @Email=administrator@localhost @Password=Administrator1! -@BearerToken= +@auth_token= # POST Users Register -POST {{Web_HostAddress}}/api/Users/Register +POST {{base_url}}/api/Users/Register Content-Type: application/json { @@ -17,7 +15,7 @@ Content-Type: application/json ### # POST Users Login -POST {{Web_HostAddress}}/api/Users/Login +POST {{base_url}}/api/Users/login Content-Type: application/json { @@ -25,11 +23,13 @@ Content-Type: application/json "password": "{{Password}}" } +> {% client.global.set("auth_token", response.body); %} + ### # POST Users Refresh -POST {{Web_HostAddress}}/api/Users/Refresh -Authorization: Bearer {{BearerToken}} +POST {{base_url}}/api/Users/Refresh +Authorization: Bearer {{auth_token}} Content-Type: application/json { @@ -39,101 +39,11 @@ Content-Type: application/json ### # GET WeatherForecast -GET {{Web_HostAddress}}/api/WeatherForecasts -Authorization: Bearer {{BearerToken}} +GET {{base_url}}/api/WeatherForecasts +Authorization: Bearer {{auth_token}} ### -# GET TodoLists -GET {{Web_HostAddress}}/api/TodoLists -Authorization: Bearer {{BearerToken}} - -### - -# POST TodoLists -POST {{Web_HostAddress}}/api/TodoLists -Authorization: Bearer {{BearerToken}} -Content-Type: application/json - -// CreateTodoListCommand -{ - "Title": "Backlog" -} - -### - -# PUT TodoLists -PUT {{Web_HostAddress}}/api/TodoLists/1 -Authorization: Bearer {{BearerToken}} -Content-Type: application/json - -// UpdateTodoListCommand -{ - "Id": 1, - "Title": "Product Backlog" -} - -### - -# DELETE TodoLists -DELETE {{Web_HostAddress}}/api/TodoLists/1 -Authorization: Bearer {{BearerToken}} - -### - -# GET TodoItems -@PageNumber = 1 -@PageSize = 10 -GET {{Web_HostAddress}}/api/TodoItems?ListId=1&PageNumber={{PageNumber}}&PageSize={{PageSize}} - -Authorization: Bearer {{BearerToken}} - -### - -# POST TodoItems -POST {{Web_HostAddress}}/api/TodoItems -Authorization: Bearer {{BearerToken}} -Content-Type: application/json - -// CreateTodoItemCommand -{ - "ListId": 1, - "Title": "Eat a burrito 🌯" -} - -### - -#PUT TodoItems UpdateItemDetails -PUT {{Web_HostAddress}}/api/TodoItems/UpdateItemDetails?Id=1 -Authorization: Bearer {{BearerToken}} -Content-Type: application/json - -// UpdateTodoItemDetailCommand -{ - "Id": 1, - "ListId": 1, - "Priority": 3, - "Note": "This is a good idea!" -} - -### - -# PUT TodoItems -PUT {{Web_HostAddress}}/api/TodoItems/1 -Authorization: Bearer {{BearerToken}} -Content-Type: application/json - -// UpdateTodoItemCommand -{ - "Id": 1, - "Title": "Eat a yummy burrito 🌯", - "Done": true -} - -### - -# DELETE TodoItem -DELETE {{Web_HostAddress}}/api/TodoItems/1 -Authorization: Bearer {{BearerToken}} - -### \ No newline at end of file +# GET GetMyUser +GET {{base_url}}/api/GetMyUser +Authorization: Bearer {{auth_token}} \ No newline at end of file diff --git a/src/Web/http-client.env.json b/src/Web/http-client.env.json new file mode 100644 index 0000000..4af4838 --- /dev/null +++ b/src/Web/http-client.env.json @@ -0,0 +1,5 @@ +{ + "dev": { + "base_url": "https://localhost:5001" + } +} \ No newline at end of file