Initial commit with basic CRUD functionality:
* GET all properties * GET one property by id * CREATE one property * DELETE one property by id
This commit is contained in:
48
bruno/propify/Authenticate/Auth.bru
Normal file
48
bruno/propify/Authenticate/Auth.bru
Normal file
@@ -0,0 +1,48 @@
|
||||
meta {
|
||||
name: Auth
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{KEYCLOAK_BASE_URL}}/realms/propify/protocol/openid-connect/token
|
||||
body: formUrlEncoded
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
}
|
||||
|
||||
body:form-urlencoded {
|
||||
grant_type: password
|
||||
client_id: {{KEYCLOAK_CLIENT_ID}}
|
||||
username: {{ADMIN_USERNAME}}
|
||||
password: {{ADMIN_PASSWORD}}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
// Parse die JSON-Antwort
|
||||
const jsonResponse = res.body;
|
||||
|
||||
|
||||
if (jsonResponse.access_token) {
|
||||
// Schreibe den access_token in eine Umgebungsvariable
|
||||
// oder in eine collection-Variable
|
||||
|
||||
// Option 1: In eine Umgebungsvariable schreiben
|
||||
// (z.B. für eine bestimmte Umgebung wie "Development")
|
||||
bru.setEnvVar("BEARER_TOKEN", jsonResponse.access_token);
|
||||
|
||||
// Option 2: In eine Collection-Variable schreiben
|
||||
// (Diese Variable ist global für alle Anfragen in deiner Collection)
|
||||
// bru.setVar("bearerToken", "Bearer " + jsonResponse.access_token);
|
||||
} else {
|
||||
// optional: Error Handling, falls der Token nicht in der Antwort ist
|
||||
console.log("Error: access_token not found in the response.");
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: false
|
||||
}
|
||||
8
bruno/propify/Authenticate/folder.bru
Normal file
8
bruno/propify/Authenticate/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Authenticate
|
||||
seq: 2
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -5,9 +5,13 @@ meta {
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{BASE_URL}}/api/{{API_VERSION}}/properties
|
||||
url: {{API_BASE_URL}}/api/{{API_VERSION}}/properties
|
||||
body: json
|
||||
auth: inherit
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: {{BEARER_TOKEN}}
|
||||
}
|
||||
|
||||
body:json {
|
||||
|
||||
@@ -5,9 +5,13 @@ meta {
|
||||
}
|
||||
|
||||
delete {
|
||||
url: {{BASE_URL}}/api/{{API_VERSION}}/properties/e64d5e53-cd45-45fb-9237-46078077bf22
|
||||
url: API_BASE_URL}}/api/{{API_VERSION}}/properties/e64d5e53-cd45-45fb-9237-46078077bf22
|
||||
body: json
|
||||
auth: inherit
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: {{BEARER_TOKEN}}
|
||||
}
|
||||
|
||||
body:json {
|
||||
|
||||
@@ -5,9 +5,13 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{BASE_URL}}/api/{{API_VERSION}}/properties
|
||||
url: {{API_BASE_URL}}/api/{{API_VERSION}}/properties
|
||||
body: none
|
||||
auth: inherit
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: {{BEARER_TOKEN}}
|
||||
}
|
||||
|
||||
settings {
|
||||
|
||||
@@ -5,9 +5,13 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{BASE_URL}}/api/{{API_VERSION}}/properties/b6ab79d8-f7eb-4fb7-acde-e3310cb0166c
|
||||
url: {{API_BASE_URL}}/api/{{API_VERSION}}/properties/5dba067e-d7fd-4d79-a08a-ec379834938a
|
||||
body: none
|
||||
auth: inherit
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: {{BEARER_TOKEN}}
|
||||
}
|
||||
|
||||
settings {
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
vars {
|
||||
BASE_URL: http://localhost:8080
|
||||
API_BASE_URL: http://localhost:8080
|
||||
API_VERSION: v1
|
||||
BEARER_TOKEN: -
|
||||
KEYCLOAK_BASE_URL: http://localhost:8280
|
||||
DEV_USERNAME: dev@example.com
|
||||
DEV_PASSWORD: dev
|
||||
ADMIN_USERNAME: admin@example.com
|
||||
ADMIN_PASSWORD: admin
|
||||
KEYCLOAK_CLIENT_ID: propify-app
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user