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:
2025-08-28 12:57:36 +02:00
parent 32e41f710b
commit 9735f1f398
14 changed files with 241 additions and 18 deletions

View 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
}

View File

@@ -0,0 +1,8 @@
meta {
name: Authenticate
seq: 2
}
auth {
mode: inherit
}

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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
}