This example fetches an existing fileplan entry, changes its name, submits the update, and re-fetches the entry to confirm the change took effect. Note the type difference between the two operations: the GET response's name is a multilingual object keyed by language code, while the update request's name is a single plain string — the language it is stored under is chosen by the requester's Fabasphere language setting, not by the caller.
Python Example
Python — round-trip example |
|---|
import requests fpe_id = "COO.1.30000.1.1234" # COO address or externalkey of an existing fileplan entry url = f"{BASE_URL}/{SERVICE_COO}/fileplanentries/{fpe_id}" # 1) Fetch current state before = requests.get(url, auth=AUTH).json() print("Name before:", before["name"]) # 2) Update the name (plain string; language is chosen by the requester's Fabasphere language) update_response = requests.post(url, json={"name": "Gemeinderat (aktualisiert)"}, auth=AUTH) print("Update status:", update_response.status_code) # 3) Re-fetch to confirm the change took effect after = requests.get(url, auth=AUTH).json() print("Name after:", after["name"]) |
Java Example
Java — round-trip example |
|---|
import java.net.URI; import java.net.http.*; import java.util.Base64; String auth = Base64.getEncoder().encodeToString((AUTH_USER + ":" + AUTH_PASSWORD).getBytes()); String fpeId = "COO.1.30000.1.1234"; // COO address or externalkey of an existing fileplan entry String url = BASE_URL + "/" + SERVICE_COO + "/fileplanentries/" + fpeId; HttpClient client = HttpClient.newHttpClient(); // 1) Fetch current state HttpRequest getBefore = HttpRequest.newBuilder(URI.create(url)) .header("Authorization", "Basic " + auth).GET().build(); HttpResponse<String> before = client.send(getBefore, HttpResponse.BodyHandlers.ofString()); System.out.println("Name before: " + before.body()); // 2) Update the name (plain string; language is chosen by the requester's Fabasphere language) String updateBody = """ {"name": "Gemeinderat (aktualisiert)"} """; HttpRequest update = HttpRequest.newBuilder(URI.create(url)) .header("Authorization", "Basic " + auth) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(updateBody)) .build(); HttpResponse<String> updateResponse = client.send(update, HttpResponse.BodyHandlers.ofString()); System.out.println("Update status: " + updateResponse.statusCode()); // 3) Re-fetch to confirm the change took effect HttpRequest getAfter = HttpRequest.newBuilder(URI.create(url)) .header("Authorization", "Basic " + auth).GET().build(); HttpResponse<String> after = client.send(getAfter, HttpResponse.BodyHandlers.ofString()); System.out.println("Name after: " + after.body()); |