= 400) { throw new RuntimeException("HTTP request failed with status " . $status . ": " . curl_error($ch) . " " . $body); } curl_close($ch); return json_decode($body, true); } $identityUrl = getenv("DECISIOQ_IDENTITY_URL") ?: "https://identity.vinquery.com/connect/token"; $catalogUrl = rtrim(getenv("DECISIOQ_DKS_URL") ?: "https://dks.vinquery.com", "/"); $decisionServiceUrl = rtrim(getenv("DECISIOQ_DDE_URL") ?: "https://dde.vinquery.com", "/"); $correlationId = "auto-part-039-php-" . time(); $tokenResponse = http_json($identityUrl, array( "clientId" => required_env("DECISIOQ_CLIENT_ID"), "clientSecret" => required_env("DECISIOQ_CLIENT_SECRET"), "audience" => getenv("DECISIOQ_AUDIENCE") ?: "vinquery:api:decisioq" )); $token = $tokenResponse["jwtToken"]; http_json($catalogUrl . "/decisioncatalog/decisions/AUTO-PART-039", null, $token, $correlationId); $payload = json_decode(file_get_contents("auto-part-039-execute.json"), true); $result = http_json($decisionServiceUrl . "/api/v1/decide", $payload, $token, $correlationId); echo json_encode($result, JSON_PRETTY_PRINT) . PHP_EOL;