Skip to content

Commit

Permalink
Refactord API testing HTTP file
Browse files Browse the repository at this point in the history
  • Loading branch information
emonney committed Oct 28, 2024
1 parent 059b5a4 commit d489d0c
Showing 1 changed file with 47 additions and 67 deletions.
114 changes: 47 additions & 67 deletions QuickApp.Server/QuickApp.Server.http
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
@QuickApp.Server_HostAddress = https://localhost:7085
@QuickApp.Client_HostAddress = https://localhost:4200
@AccessToken = <Paste Access Token Here>
@AccessToken = Paste_access_token_here

#### This file enables you to test the APIs of QuickApp.
#### You can also test the APIs with Swagger by appending "/swagger"" to the home url or by using postman
#### See https://learn.microsoft.com/en-us/aspnet/core/test/http-files?view=aspnetcore-8.0 for more info on http files


###################################################
### Login to get access token
###################################################
POST {{QuickApp.Server_HostAddress}}/connect/token
Content-Type: application/x-www-form-urlencoded

client_id=swagger_ui&grant_type=password&username=admin&password=tempP@ss123

#### User APIs ####

###################################################
### User APIs
###################################################

### Get all users
GET {{QuickApp.Server_HostAddress}}/api/account/users
Expand All @@ -24,11 +30,6 @@ GET {{QuickApp.Server_HostAddress}}/api/account/users/me
Accept: application/json
Authorization: Bearer {{AccessToken}}

### Get user with username "admin"
GET {{QuickApp.Server_HostAddress}}/api/account/users/username/admin
Accept: application/json
Authorization: Bearer {{AccessToken}}

### Register new user
POST {{QuickApp.Server_HostAddress}}/api/account/users
Authorization: Bearer {{AccessToken}}
Expand All @@ -42,54 +43,43 @@ Content-Type: application/json
"roles": ["administrator"]
}

### Delete an exisint user
POST {{QuickApp.Server_HostAddress}}/api/account/users
### Get newly registered user with username "test_1"
GET {{QuickApp.Server_HostAddress}}/api/account/users/username/test_1
Accept: application/json
Authorization: Bearer {{AccessToken}}
Content-Type: application/json

{
"userName": "test_1",
"email": "[email protected]",
"isEnabled": true,
"newPassword": "testP@ss123",
"roles": ["administrator"]
}

### Update user with id "1445aa42-b5d3-4f2b-b702-8c2b9f526c0f"
PUT {{QuickApp.Server_HostAddress}}/api/account/users/1445aa42-b5d3-4f2b-b702-8c2b9f526c0f
### Update user with a specific id
PUT {{QuickApp.Server_HostAddress}}/api/account/users/Paste_user_id_here
Authorization: Bearer {{AccessToken}}
Content-Type: application/json

{
"id": "1445aa42-b5d3-4f2b-b702-8c2b9f526c0f",
"userName": "admin",
"fullName": "Inbuilt Administrator",
"email": "[email protected]",
"userName": "test_1",
"fullName": "My New Fullname",
"email": "[email protected]",
"isEnabled": true,
"isLockedOut": false,
"jobTitle": "Dr",
"phoneNumber": "+1 (123) 000-0000",
"jobTitle": "Dr.",
"phoneNumber": "+2 (456) 123-789",
"roles": ["administrator"]
}

### Delete user with id "1445aa42-b5d3-4f2b-b702-8c2b9f526c0f"
DELETE {{QuickApp.Server_HostAddress}}/api/account/users/a5ce6e4a-ccb9-4c73-b0bb-157f1c6672a9
### Delete user with a specific id
DELETE {{QuickApp.Server_HostAddress}}/api/account/users/Paste_user_id_here
Authorization: Bearer {{AccessToken}}

### Role APIs ####

###################################################
### Role APIs
###################################################

### Get all roles
GET {{QuickApp.Server_HostAddress}}/api/account/roles
Accept: application/json
Authorization: Bearer {{AccessToken}}

### Get current role
GET {{QuickApp.Server_HostAddress}}/api/account/roles/7ededf4b-c535-4976-ad10-feb3e1aa681c
Accept: application/json
Authorization: Bearer {{AccessToken}}

### Get role with rolename "admin"
GET {{QuickApp.Server_HostAddress}}/api/account/roles/rolename/admin
### Get role with a specific id
GET {{QuickApp.Server_HostAddress}}/api/account/roles/Paste_role_id_here
Accept: application/json
Authorization: Bearer {{AccessToken}}

Expand All @@ -99,51 +89,41 @@ Authorization: Bearer {{AccessToken}}
Content-Type: application/json

{
"roleName": "test_1",
"email": "[email protected]",
"isEnabled": true,
"newPassword": "testP@ss123",
"roles": ["administrator"]
"name": "test_1",
"description": "Test role 1"
}

### Delete an exisint role
POST {{QuickApp.Server_HostAddress}}/api/account/roles
### Get newly registered role with role name "test_1"
GET {{QuickApp.Server_HostAddress}}/api/account/roles/name/test_1
Accept: application/json
Authorization: Bearer {{AccessToken}}
Content-Type: application/json

{
"roleName": "test_1",
"email": "[email protected]",
"isEnabled": true,
"newPassword": "testP@ss123",
"roles": ["administrator"]
}

### Update role with id "7ededf4b-c535-4976-ad10-feb3e1aa681c"
PUT {{QuickApp.Server_HostAddress}}/api/account/roles/7ededf4b-c535-4976-ad10-feb3e1aa681c
### Update role with a specific id
PUT {{QuickApp.Server_HostAddress}}/api/account/roles/Paste_role_id_here
Authorization: Bearer {{AccessToken}}
Content-Type: application/json

{
"id": "7ededf4b-c535-4976-ad10-feb3e1aa681c",
"roleName": "admin",
"fullName": "Inbuilt Administrator",
"email": "[email protected]",
"isEnabled": true,
"isLockedOut": false,
"jobTitle": "Dr",
"phoneNumber": "+1 (123) 000-0000",
"roles": ["administrator"]
"name": "test_123",
"description": "New test role 1 description",
"permissions": [
{"value": "users.view"},
{"value": "roles.view"}
]
}

### Delete role with id "7ededf4b-c535-4976-ad10-feb3e1aa681c"
DELETE {{QuickApp.Server_HostAddress}}/api/account/roles/7ededf4b-c535-4976-ad10-feb3e1aa681c

### Delete role with a specific id
DELETE {{QuickApp.Server_HostAddress}}/api/account/roles/Paste_role_id_here
Authorization: Bearer {{AccessToken}}

### Customer APIs ###

###################################################
### Customer APIs
###################################################

### Get dummy customers
GET {{QuickApp.Client_HostAddress}}/api/Customer
Accept: */*

###
### ... Add more APIs here

0 comments on commit d489d0c

Please sign in to comment.